UserGroup.RemoveUserFromGroup Method

Removes the specified user from the specified group.

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

Syntax

<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/RemoveUserFromGroup", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/directory/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Sub RemoveUserFromGroup ( _
    groupName As String, _
    userLoginName As String _
)

Dim instance As UserGroup
Dim groupName As String
Dim userLoginName As String

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

Parameters

  • groupName
    A string that contains the name of the group.
  • userLoginName
    A string that contains the user name (DOMAIN\User_Alias) of the user.

Example

The following code example removes the specified user from a group.

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

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

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

See Also

Reference

UserGroup Class
UserGroup Members
Users and Groups Web Service