Compartir a través de


Removing Members from a Group

You can remove a member from a group by removing the distinguished name of the member from the member property of the group. To remove the distinguished name, call the Remove method with the distinguished name of the member to remove. For more information about the member property, see the topic Member in the Active Directory Schema SDK documentation in the MSDN Library at https://go.microsoft.com/fwlink/?LinkID=27252.

The following example shows how to remove a member from a group. You complete this task by first finding the user to remove, and then calling the Remove method.

// Bind to the group.
DirectoryEntry group = new DirectoryEntry(groupDN);

// Remove the user from the group.
group.Properties["member"].Remove(userDN);

// Commit the changes to the directory.
group.CommitChanges();

See Also

Reference

PropertyValueCollection
System.DirectoryServices

Concepts

Group Management

Send comments about this topic to Microsoft.

Copyright © 2007 by Microsoft Corporation. All rights reserved.