UserGroup.GetGroupCollection Method

Returns information about the specified groups in the current site collection.

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

Syntax

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

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

Parameters

  • groupNamesXml
    Type: System.Xml.XmlNode

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

    <Groups>
       <Group GroupName="Group1"/>
       <Group GroupName="Group2"/>
       .
       .
       .
    </Groups>
    

Return Value

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

<GetGroupCollection 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" />
      .
      .
      .
   </Groups>
</GetGroupCollection>

Examples

The following code example displays information about specified groups 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.GetGroupCollection(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.GetGroupCollection(ndGroupNames);

MessageBox.Show(ndGroups.OuterXml);

See Also

Reference

UserGroup Class

UserGroup Members

UserGroup Web Service