UserGroup.GetGroupCollectionFromUser Method (Users and Groups)
UserGroup.GetGroupCollectionFromUser Method (Users and Groups)
Returns information about the collection of groups of which the specified user is a member.

Web Service: Users and GroupsWeb Reference: http://<Site>/_vti_bin/usergroup.asmx
Syntax

'Usage

Dim instance As UserGroup
Dim userLoginName As String
Dim returnValue As XmlNode

returnValue = instance.GetGroupCollectionFromUser(userLoginName)

'Declaration

<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/GetGroupCollectionFromUser", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/directory/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function GetGroupCollectionFromUser ( _
    userLoginName As String _
) As XmlNode

Parameters

userLoginName

A string that contains the user name (DOMAIN\User_Alias) of the user.

Return Value

An XML fragment in the following form that can be assigned to a System.Xml.XmlNode object.
<GetGroupCollectionFromUser xmlns=
   "http://schemas.microsoft.com/sharepoint/soap/directory/">
   <Groups>
      <Group ID="3" Name="Group1" Description="Description" OwnerID="1" 
         OwnerIsUser="False" />
      <Group ID="15" Name="Group2" Description="Description" 
         OwnerID="12" OwnerIsUser="True" />
      <Group ID="16" Name="Group3" Description="Description" 
         OwnerID="7" OwnerIsUser="False" />
   </Groups>
</GetGroupCollectionFromUser>
Example

The following code example displays information about the groups of which a specified user is a member. This example requires that a using (Visual C#) or Imports (Visual Basic) directive be included for the System.Xml namespace.

Dim usrgrpService As New Web_Reference_Folder_Name.UserGroup()
usrgrpService.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim ndGroups As System.Xml.XmlNode = usrgrpService.GetGroupCollectionFromUser("DOMAIN\User_Alias")

MessageBox.Show(ndGroups.OuterXml)
See Also

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View