Directory Services

Deleting Groups

The following code example shows how to delete a group using the DirectoryEntries method called Remove. For this task, find the group to delete, which, in the example, is Consulting, then run the Remove method.

[C#]
DirectoryEntry dom = new DirectoryEntry();
DirectoryEntry ou = dom.Children.Find("OU=Consulting");
ou.Children.Remove(group);
ou.Children.Remove(mgr);
ou.Children.Remove(dl);