Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
SDK Documentation
Web Services
UserGroup Class
UserGroup Methods
 GetGroupCollectionFromSite Method
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
UserGroup.GetGroupCollectionFromSite Method (Users and Groups)
Returns information about the collection of groups for the current site collection.

Web Service: Users and GroupsWeb Reference: http://<Site>/_vti_bin/usergroup.asmx
Visual Basic (Declaration)
<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/GetGroupCollectionFromSite", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/directory/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function GetGroupCollectionFromSite As XmlNode
Visual Basic (Usage)
Dim instance As UserGroup
Dim returnValue As XmlNode

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

Return Value

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

The following code example displays information about the collection of groups in the current site collection. This example requires that a using (Visual C#) 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.GetGroupCollectionFromSite()

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.GetGroupCollectionFromSite();

MessageBox.Show(ndGroups.OuterXml);
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker