UserGroup.AddUserToGroup Method

Adds the user to the specified group.

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

Syntax

<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 Sub AddUserToGroup ( _
    groupName As String, _
    userName As String, _
    userLoginName As String, _
    userEmail As String, _
    userNotes As String _
)

Dim instance As UserGroup
Dim groupName As String
Dim userName As String
Dim userLoginName As String
Dim userEmail As String
Dim userNotes As String

instance.AddUserToGroup(groupName, userName, userLoginName, userEmail, userNotes)
[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
    A string that contains the name of the group.
  • userName
    A string that contains the display name of the user.
  • userLoginName
    A string that contains the user name (DOMAIN\User_Alias) of the user.
  • userEmail
    A string that contains the e-mail address of the user.
  • userNotes
    A string that contains notes for the user.

Example

The following example adds a user to a group.

Dim usrgrpService As 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")
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");

See Also

Reference

UserGroup Class
UserGroup Members
Users and Groups Web Service