UserGroup.RemoveUserCollectionFromRole Method
Removes the users with the specified user names from the specified role definition.
Web Service: Users and GroupsWeb Reference: http://<Site>/_vti_bin/usergroup.asmx
Syntax
<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/RemoveUserCollectionFromRole", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/directory/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Sub RemoveUserCollectionFromRole ( _
roleName As String, _
userLoginNamesXml As XmlNode _
)
Dim instance As UserGroup
Dim roleName As String
Dim userLoginNamesXml As XmlNode
instance.RemoveUserCollectionFromRole(roleName, userLoginNamesXml)
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/RemoveUserCollectionFromRole", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)]
public void RemoveUserCollectionFromRole (
string roleName,
XmlNode userLoginNamesXml
)
Parameters
- roleName
A string that contains the name of the role definition.
userLoginNamesXml
A System.Xml.XmlNode object that contains the user names (DOMAIN\User_Alias) of the users in the following form:<Users> <User LoginName= "Domain\User1_Alias"/> <User LoginName= "Domain\User2_Alias"/> . . . </Users>
Example
The following code example removes a collection of users from a role definition. The example assumes the existence of a local XML file that contains the names of the users, which are loaded into a System.Xml.XmlDocument object. This example requires that a using (Visual C#) or Imports (Visual Basic) directive be included for the System.Xml namespace.
Dim usrgrpService As New Web_Reference_Folder_Name.UserGroup()
usrgrpService.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim myDocument As New XmlDocument()
myDocument.Load("C:\File_Name.xml")
Dim ndUsers As XmlNode = myDocument.DocumentElement
usrgrpService.RemoveUserCollectionFromRole("Group_Name", ndUsers)
Web_Reference_Folder_Name.UserGroup usrgrpService = new Web_Reference_Folder_Name.UserGroup();
usrgrpService.Credentials= System.Net.CredentialCache.DefaultCredentials;
XmlDocument myDocument = new XmlDocument();
myDocument.Load("C:\\File_Name.xml");
XmlNode ndUsers = myDocument.DocumentElement;
usrgrpService.RemoveUserCollectionFromRole("Group_Name", ndUsers);
See Also
Reference
UserGroup Class
UserGroup Members
Users and Groups Web Service