共用方式為


UserGroup.RemoveUserFromRole Method

Removes the specified user from 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/RemoveUserFromRole", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub RemoveUserFromRole ( _
    roleName As String, _
    userLoginName As String _
)
'Usage
Dim instance As UserGroup
Dim roleName As String
Dim userLoginName As String

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

Parameters

  • roleName
    Type: System.String

    A string that contains the name of the role definition.

  • userLoginName
    Type: System.String

    A string that contains the user name (DOMAIN\User_Alias) of the user.

Examples

The following code example removes the specified user from a role definition.

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

usrgrpService.RemoveUserFromRole("Group_Name", "DOMAIN\User_Alias")
Web_Reference_Folder_Name.UserGroup usrgrpService = new Web_Reference_Folder_Name.UserGroup();
usrgrpService.Credentials= System.Net.CredentialCache.DefaultCredentials;

usrgrpService.RemoveUserFromRole("Group_Name", "DOMAIN\\User_Alias");

See Also

Reference

UserGroup Class

UserGroup Members

UserGroup Web Service