共用方式為


UserGroup.GetRoleCollectionFromWeb Method

Returns information about the collection of groups 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/GetRoleCollectionFromWeb", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetRoleCollectionFromWeb As XmlNode
'Usage
Dim instance As UserGroup
Dim returnValue As XmlNode

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

Return Value

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

<GetRoleCollectionFromWeb xmlns="https://schemas.microsoft.com/sharepoint/soap/directory/">
   <Roles>
      <Role ID="1073741825" Name="Guest" Description="Can view specific 
         lists or document libraries when given permissions." 
         Type="1" />
      <Role ID="1073741826" Name="Reader" Description="Has read-only 
         access to the Web site." Type="2" />
      <Role ID="1073741827" Name="Contributor" Description="Can add 
         content to existing document libraries and lists." Type="3" />
      <Role ID="1073741828" Name="Web Designer" Description="Can create 
         lists and document libraries and customize pages in the Web 
         site." Type="4" />
      <Role ID="1073741829" Name="Administrator" Description="Has full  
         control of the Web site." Type="5" />
      <Role ID="3" Name="Group6" Description="Description" OwnerID="1" 
         OwnerIsUser="False" />
      <Role ID="15" Name="Group7" Description="Description" 
         OwnerID="12" OwnerIsUser="True" />
      <Role ID="16" Name="Group8" Description="Description" OwnerID="7" 
         OwnerIsUser="False" />
      .
      .
      .
   </Roles>
</GetRoleCollectionFromWeb>

Examples

The following code example displays information about the collection of groups on the current Web site. 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.GetGroupCollectionFromWeb()

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

System.Xml.XmlNode ndGroups = usrgrpService.GetGroupCollectionFromWeb();

MessageBox.Show(ndGroups.OuterXml);

See Also

Reference

UserGroup Class

UserGroup Members

UserGroup Web Service