Partilhar via


UserGroup.GetRoleCollection Method

Returns information about the specified collection of role definitions for the current Web site.

Namespace:  [UserGroup Web service]
Web service reference: http://Site/_vti_bin/UserGroup.asmx

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/directory/GetRoleCollection", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetRoleCollection ( _
    roleNamesXml As XmlNode _
) As XmlNode
'Usage
Dim instance As UserGroup
Dim roleNamesXml As XmlNode
Dim returnValue As XmlNode

returnValue = instance.GetRoleCollection(roleNamesXml)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/directory/GetRoleCollection", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/directory/", 
    ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/directory/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public XmlNode GetRoleCollection(
    XmlNode roleNamesXml
)

Parameters

  • roleNamesXml
    Type: System.Xml.XmlNode

    A System.Xml.XmlNode object that specifies one or more role definition names in the following form:

    <Roles>
       <Role RoleName="Site_Group1"/>
       <Role RoleName="Site_Group2"/>
       .
       .
       .
    </Roles>
    

Return Value

Type: System.Xml.XmlNode
An XML fragment in the following form that can be assigned to a System.Xml.XmlNode object.

<GetRoleCollection xmlns=
   "https://schemas.microsoft.com/sharepoint/soap/directory/">
   <Roles>
      <Role ID="1073741830" Name="Site_Group1" 
         Description="Description" Type="0" />
      <Role ID="1073741831" Name="Site_Group2" 
         Description="Description" Type="0" />
      .
      .
      .
   </Roles>
</GetRoleCollection>

Examples

The following code example displays information about specified role definitions on a Web site. The example assumes the existence of a local XML file that contains the names of the groups, which are loaded into a System.Xml.XmlDocument object. 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 myDocument As New XmlDocument()
myDocument.Load("C:\File_Name.xml")

Dim ndGroupNames As XmlNode = myDocument.DocumentElement

Dim ndGroups As System.Xml.XmlNode = usrgrpService.GetRoleCollection(ndGroupNames)

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

XmlDocument myDocument = new XmlDocument();
myDocument.Load("C:\\File_Name.xml");

XmlNode ndGroupNames = myDocument.DocumentElement;

System.Xml.XmlNode ndGroups = usrgrpService.GetRoleCollection(ndGroupNames);

MessageBox.Show(ndGroups.OuterXml);

See Also

Reference

UserGroup Class

UserGroup Members

UserGroup Web Service