UserGroup.AddUserToRole Method
Windows SharePoint Services 3
Adds the user to the specified role definition.
Web Service: Users and GroupsWeb Reference: http://<Site>/_vti_bin/usergroup.asmx
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/AddUserToRole", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] public void AddUserToRole ( string roleName, string userName, string userLoginName, string userEmail, string userNotes )
Parameters
- roleName
A string that contains the name of the role definition.
- 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.
The following code example adds a user to a specified role definition on the current site.
Dim usrgrpService As New Web_Reference_Folder_Name.UserGroup() usrgrpService.Credentials = System.Net.CredentialCache.DefaultCredentials usrgrpService.AddUserToRole("Role_Definition", "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.AddUserToRole("Role_Definition", "User_Display_Name", "DOMAIN\\User_Alias", "User_E-mail", "Notes");