This documentation is archived and is not being maintained.

UserGroup.GetUserCollection Method

Windows SharePoint Services 3
Returns information about a collection of users based on the specified user names.

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

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

Parameters

userLoginNamesXml

A System.Xml.XmlNode object that contains information about the users in the following form:

<Users>
   <User LoginName=
      "DOMAIN\User1_Alias" 
      Email="User1_E-mail" 
      Name="User1_Display_Name" 
      Notes="Notes"/>
   <User LoginName=
      "DOMAIN\User2_Alias" 
      Email="User2_E-mail" 
      Name="User2_Display_Name" 
      Notes="Notes"/>
   .
   .
   .
</Users>

Return Value

An XML fragment in the following form that can be assigned to a System.Xml.XmlNode object.
<GetUserCollection xmlns=
      "http://schemas.microsoft.com/sharepoint/soap/directory/">
   <Users>
      <User ID="4" Sid="S-1-5-21-2127521184-1604012920-1887927527-
         34577" Name="User1_Display_Name" 
         LoginName="DOMAIN\User1_Alias" Email="User1_E-mail" 
         Notes="Notes" IsSiteAdmin="False" IsDomainGroup="False" />
      <User ID="5" Sid="S-1-5-21-2127521184-1604012920-1887927527-
         354403" Name="User2_Display_Name" 
         LoginName="DOMAIN\User2_Alias" Email="User2_E-mail" 
         Notes="Notes" IsSiteAdmin="False" IsDomainGroup="False" />
         .
         .
         .
   </Users>
</GetUserCollection>

The following code example displays information about specified users on a Web site. The example assumes the existence of a local XML file that contains the names of the users, 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

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 ndUserNames = myDocument.DocumentElement;

System.Xml.XmlNode ndUsers = usrgrpService.GetGroupCollection(ndUserNames);

MessageBox.Show(ndUsers.OuterXml);
Show: