This topic has not yet been rated - Rate this topic

UserGroup.AddUserToGroup Method

SharePoint 2010

Adds the user to the specified group.

Namespace:  [UserGroup Web service]
Web service reference: http://Site/_vti_bin/UserGroup.asmx
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/AddUserToGroup", RequestNamespace = "http://schemas.microsoft.com/sharepoint/soap/directory/", 
	ResponseNamespace = "http://schemas.microsoft.com/sharepoint/soap/directory/", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void AddUserToGroup(
	string groupName,
	string userName,
	string userLoginName,
	string userEmail,
	string userNotes
)

Parameters

groupName
Type: System.String
A string that contains the name of the group.
userName
Type: System.String
A string that contains the display name of the user.
userLoginName
Type: System.String
A string that contains the user name (DOMAIN\User_Alias) of the user.
userEmail
Type: System.String
A string that contains the e-mail address of the user.
userNotes
Type: System.String
A string that contains notes for the user.

The following example adds a user to a group.

Web_Reference_Folder_Name.UserGroup usrgrpService = new Web_Reference_Folder_Name.UserGroup();
usrgrpService.Credentials= System.Net.CredentialCache.DefaultCredentials;

usrgrpService.AddUserToGroup("Group_Name","User_Display_Name",
    "DOMAIN\\User_Alias","User_E-mail","Notes");
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ