At some point of time there might be a requirement to access a SharePoint site programmatically and list the names of all the groups a user is associated to without using SharePoint APIs. Here is a small piece of code in C# which demonstrates how to achieve the above action using web service(s) available for a SharePoint site. First you need to add a reference of the UserGroup web service to your solution.
try { UserGroup.UserGroup userGrp = new TestApplication.UserGroup.UserGroup(); userGrp.Url = "http://SPSite/_vti_bin/UserGroup.asmx"; userGrp.PreAuthenticate = false; userGrp.UseDefaultCredentials = true; XmlNode node = userGrp.GetGroupCollectionFromUser("userLoginName"); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(new XmlNodeReader(node)); XmlNamespaceManager nmSpcMngr = new XmlNamespaceManager(xmlDoc.NameTable); nmSpcMngr.AddNamespace("sp", "http://schemas.microsoft.com/sharepoint/soap/directory/"); String[] names = new String[xmlDoc.SelectNodes("//sp:Groups/sp:Group", nmSpcMngr).Count]; int groupCount = 0; foreach (XmlNode groupName in xmlDoc.SelectNodes("//sp:Groups/sp:Group", nmSpcMngr)) { names[groupCount] = groupName.Attributes["Name"].Value; groupCount += 1; } } catch { }