UserGroup.GetGroupCollectionFromRole Method (Users and Groups)
Returns information about the collection of groups assigned to the specified role definition.

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

Visual Basic (Declaration)
<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/GetGroupCollectionFromRole", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/directory/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function GetGroupCollectionFromRole ( _
    roleName As String _
) As XmlNode
Visual Basic (Usage)
Dim instance As UserGroup
Dim roleName As String
Dim returnValue As XmlNode

returnValue = instance.GetGroupCollectionFromRole(roleName)
C#
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/GetGroupCollectionFromRole", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public XmlNode GetGroupCollectionFromRole (
    string roleName
)

Parameters

roleName

A string that contains the name of the role definition.

Return Value

An XML fragment in the following form that can be assigned to a System.Xml.XmlNode object.
Xml
<GetGroupCollectionFromRole 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>
</GetGroupCollectionFromRole>
Example

The following code example displays information about the collection of groups assigned to a specified role definition. This example requires that a using (Visual #) or Imports (Visual Basic) directive be included for the System.Xml namespace.

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

Dim ndGroups As System.Xml.XmlNode = usrgrpService.GetGroupCollectionFromRole("Role_Definition_Name")

MessageBox.Show(ndGroups.OuterXml)
C#
Web_Reference_Folder_Name.UserGroup usrgrpService = new Web_Reference_Folder_Name.UserGroup();
usrgrpService.Credentials= System.Net.CredentialCache.DefaultCredentials;

System.Xml.XmlNode ndGroups = usrgrpService.GetGroupCollectionFromRole("Role_Definition_Name");

MessageBox.Show(ndGroups.OuterXml);
See Also

Tags :


Page view tracker