Partager via


Deleting a Sub-Tree of Objects

To delete an entry and all of its children, call the DeleteTree method. The DeleteTree method deletes the current entry and all of its subtree entries from the hierarchy.

The following code snippet shows how to remove a tree of objects from the directory.

Dim entry As New DirectoryServices.DirectoryEntry( _
               "LDAP://Fabrikam.com/cn=MyContainer,dc=Fabrikam,dc=com")
entry.DeleteTree()
System.DirectoryServices.DirectoryEntry entry = 
   new System.DirectoryServices.DirectoryEntry(
            "LDAP://Fabrikam.com/cn=MyContainer,dc=Fabrikam,dc=com");
entry.DeleteTree();

See Also

Reference

System.DirectoryServices
DirectoryEntry

Concepts

Deleting Directory Objects

Send comments about this topic to Microsoft.

Copyright © 2007 by Microsoft Corporation. All rights reserved.