This documentation is archived and is not being maintained.

DirectoryEntry Class

Encapsulates a node or object in the Active Directory hierarchy.

For a list of all members of this type, see DirectoryEntry Members.


[Visual Basic]
Public Class DirectoryEntry
   Inherits Component
public class DirectoryEntry : Component
public __gc class DirectoryEntry : public Component
public class DirectoryEntry extends Component

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Use this class for binding to objects, or reading and updating attributes. DirectoryEntry, along with helper classes, provides support for life-cycle management and navigation methods. These include creating, deleting, renaming, moving a child node, and enumerating children. After you modify a node, you must commit your changes in order for them to be saved to the tree. For more information, see the CommitChanges property and Introduction to Active Directory Objects in Visual Studio.NET.

DirectoryEntry can be used to access regular entries and some, but not all, information from schema entries.

The Active Directory hierarchy contains up to several thousand nodes. Each node represents an object, such as a network printer or a user in a domain. Corporate networks constantly change as new employees are hired and objects such as network printers and computers are added. Active Directory Service Interfaces (ADSI) technology provides ways to programmatically add these objects to the directory tree.

To create a directory entry in the hierarchy, use the Children property. The Children property is a collection that provides an Add method, through which you add a node to the collection directly below the parent node that you are currently bound to. When adding a node to the collection, you must specify a name for the new node and the name of a schema template that you want to associate with the node. For example, you might want to use a schema titled "Computer" to add new computers to the hierarchy.

This class also contains attribute caching, which can be useful for optimizing network traffic. To use attribute caching, see the UsePropertyCache property.

The classes associated with the DirectoryEntry component can be used with any of the Active Directory service providers. Some of the current providers are Internet Information Services (IIS), Lightweight Directory Access Protocol (LDAP), Novell NetWare Directory Service (NDS), and WinNT.

Note   It is assumed that you have a general understanding of Active Directory before using this class. For more information, see the System.DirectoryServices namespace overview.


Namespace: System.DirectoryServices

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Directoryservices (in System.Directoryservices.dll)

See Also

DirectoryEntry Members | System.DirectoryServices Namespace | DirectoryEntries | PropertyCollection | PropertyValueCollection | DirectorySearcher | ReferralChasingOption | SearchResultCollection | SearchResult | ResultPropertyValueCollection | SearchScope | SortDirection | SortOption