Partilhar via


UserGroup.AddGroupToRole Method

Adds the specified group to the specified role definition.

Namespace:  [UserGroup Web service]
Web service reference: http://Site/_vti_bin/UserGroup.asmx

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/directory/AddGroupToRole", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub AddGroupToRole ( _
    roleName As String, _
    groupName As String _
)
'Usage
Dim instance As UserGroup
Dim roleName As String
Dim groupName As String

instance.AddGroupToRole(roleName, groupName)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/directory/AddGroupToRole", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/directory/", 
    ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/directory/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void AddGroupToRole(
    string roleName,
    string groupName
)

Parameters

  • roleName
    Type: System.String

    A string that contains the name of the role definition.

  • groupName
    Type: System.String

    A string that contains the name of the group.

Examples

The following code example adds a group to a role definition.

Dim usrgrpService As New Web_Reference_Folder_Name.UserGroup()
usrgrpService.Credentials = System.Net.CredentialCache.DefaultCredentials

usrgrpService.AddGroupToRole("Role_Definition", " Group")
Web_Reference_Folder_Name.UserGroup usrgrpService = new Web_Reference_Folder_Name.UserGroup();
usrgrpService.Credentials= System.Net.CredentialCache.DefaultCredentials;

usrgrpService.AddGroupToRole("Role_Definition", "Group");

See Also

Reference

UserGroup Class

UserGroup Members

UserGroup Web Service