DirectoryEntry DirectoryEntry DirectoryEntry DirectoryEntry Class

Definition

The DirectoryEntry class encapsulates a node or object in the Active Directory Domain Services hierarchy.

public ref class DirectoryEntry : System::ComponentModel::Component
[System.ComponentModel.TypeConverter(typeof(System.DirectoryServices.Design.DirectoryEntryConverter))]
[System.DirectoryServices.DSDescription("DirectoryEntryDesc")]
public class DirectoryEntry : System.ComponentModel.Component
type DirectoryEntry = class
    inherit Component
Public Class DirectoryEntry
Inherits Component
Inheritance
Attributes

Remarks

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.

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

The Active Directory Domain Services 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 Domain Services 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 Domain Services before using this class. For more information, see the System.DirectoryServices namespace overview.

Constructors

DirectoryEntry() DirectoryEntry() DirectoryEntry() DirectoryEntry()

Initializes a new instance of the DirectoryEntry class.

DirectoryEntry(Object) DirectoryEntry(Object) DirectoryEntry(Object) DirectoryEntry(Object)

Initializes a new instance of the DirectoryEntry class that binds to the specified native Active Directory Domain Services object.

DirectoryEntry(String) DirectoryEntry(String) DirectoryEntry(String) DirectoryEntry(String)

Initializes a new instance of the DirectoryEntry class that binds this instance to the node in Active Directory Domain Services located at the specified path.

DirectoryEntry(String, String, String) DirectoryEntry(String, String, String) DirectoryEntry(String, String, String) DirectoryEntry(String, String, String)

Initializes a new instance of the DirectoryEntry class.

DirectoryEntry(String, String, String, AuthenticationTypes) DirectoryEntry(String, String, String, AuthenticationTypes) DirectoryEntry(String, String, String, AuthenticationTypes) DirectoryEntry(String, String, String, AuthenticationTypes)

Initializes a new instance of the DirectoryEntry class.

Properties

AuthenticationType AuthenticationType AuthenticationType AuthenticationType

Gets or sets the type of authentication to use.

CanRaiseEvents CanRaiseEvents CanRaiseEvents CanRaiseEvents

Gets a value indicating whether the component can raise an event.

(Inherited from Component)
Children Children Children Children

Gets the child entries of this node in the Active Directory Domain Services hierarchy.

Container Container Container Container

Gets the IContainer that contains the Component.

(Inherited from Component)
DesignMode DesignMode DesignMode DesignMode

Gets a value that indicates whether the Component is currently in design mode.

(Inherited from Component)
Events Events Events Events

Gets the list of event handlers that are attached to this Component.

(Inherited from Component)
Guid Guid Guid Guid

Gets the GUID of the DirectoryEntry.

Name Name Name Name

Gets the name of the object as named with the underlying directory service.

NativeGuid NativeGuid NativeGuid NativeGuid

Gets the GUID of the DirectoryEntry, as returned from the provider.

NativeObject NativeObject NativeObject NativeObject

Gets the native Active Directory Service Interfaces (ADSI) object.

ObjectSecurity ObjectSecurity ObjectSecurity ObjectSecurity

Gets or sets the security descriptor for this entry.

Options Options Options Options

Gets the provider-specific options for this entry.

Parent Parent Parent Parent

Gets this entry's parent in the Active Directory Domain Services hierarchy.

Password Password Password Password

Sets the password to use when authenticating the client.

Path Path Path Path

Gets or sets the path for this DirectoryEntry.

Properties Properties Properties Properties

Gets the Active Directory Domain Services properties for this DirectoryEntry object.

SchemaClassName SchemaClassName SchemaClassName SchemaClassName

Gets the name of the schema class for this DirectoryEntry object.

SchemaEntry SchemaEntry SchemaEntry SchemaEntry

Gets the schema object for this entry.

Site Site Site Site

Gets or sets the ISite of the Component.

(Inherited from Component)
UsePropertyCache UsePropertyCache UsePropertyCache UsePropertyCache

Gets or sets a value indicating whether the cache should be committed after each operation.

Username Username Username Username

Gets or sets the user name to use when authenticating the client.

Methods

Close() Close() Close() Close()

Closes the DirectoryEntry object and releases any system resources that are associated with this component.

CommitChanges() CommitChanges() CommitChanges() CommitChanges()

Saves changes that are made to a directory entry to the underlying directory store.

CopyTo(DirectoryEntry) CopyTo(DirectoryEntry) CopyTo(DirectoryEntry) CopyTo(DirectoryEntry)

Creates a copy of this entry as a child of the specified parent.

CopyTo(DirectoryEntry, String) CopyTo(DirectoryEntry, String) CopyTo(DirectoryEntry, String) CopyTo(DirectoryEntry, String)

Creates a copy of this DirectoryEntry object, as a child of the specified parent DirectoryEntry object, with the specified new name.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
DeleteTree() DeleteTree() DeleteTree() DeleteTree()

Deletes this entry and its entire subtree from the Active Directory Domain Services hierarchy.

Dispose() Dispose() Dispose() Dispose()

Releases all resources used by the Component.

(Inherited from Component)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Disposes of the resources (other than memory) that are used by the DirectoryEntry.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Exists(String) Exists(String) Exists(String) Exists(String)

Determines if the specified path represents an actual entry in the directory service.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetService(Type) GetService(Type) GetService(Type) GetService(Type)

Returns an object that represents a service provided by the Component or by its Container.

(Inherited from Component)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
Invoke(String, Object[]) Invoke(String, Object[]) Invoke(String, Object[]) Invoke(String, Object[])

Calls a method on the native Active Directory Domain Services object.

InvokeGet(String) InvokeGet(String) InvokeGet(String) InvokeGet(String)

Gets a property from the native Active Directory Domain Services object.

InvokeSet(String, Object[]) InvokeSet(String, Object[]) InvokeSet(String, Object[]) InvokeSet(String, Object[])

Sets a property on the native Active Directory Domain Services object.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
MoveTo(DirectoryEntry) MoveTo(DirectoryEntry) MoveTo(DirectoryEntry) MoveTo(DirectoryEntry)

Moves this DirectoryEntry object to the specified parent.

MoveTo(DirectoryEntry, String) MoveTo(DirectoryEntry, String) MoveTo(DirectoryEntry, String) MoveTo(DirectoryEntry, String)

Moves this DirectoryEntry object to the specified parent and changes its name to the specified value.

RefreshCache() RefreshCache() RefreshCache() RefreshCache()

Loads the property values for this DirectoryEntry object into the property cache.

RefreshCache(String[]) RefreshCache(String[]) RefreshCache(String[]) RefreshCache(String[])

Loads the values of the specified properties into the property cache.

Rename(String) Rename(String) Rename(String) Rename(String)

Changes the name of this DirectoryEntry object.

ToString() ToString() ToString() ToString()

Returns a String containing the name of the Component, if any. This method should not be overridden.

(Inherited from Component)

Events

Disposed Disposed Disposed Disposed

Occurs when the component is disposed by a call to the Dispose() method.

(Inherited from Component)

Security

DirectoryServicesPermission
LinkDemand

Applies to