DirectoryEntry DirectoryEntry DirectoryEntry DirectoryEntry Class

定义

DirectoryEntry 类可封装 Active Directory 域服务层次结构中的节点或对象。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
继承
属性

注解

使用此类用于绑定到对象,或读取和更新属性。Use this class for binding to objects, or reading and updating attributes. DirectoryEntry以及帮助器类,提供的支持生命周期管理和导航方法。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. 有关更多信息,请参见 CommitChanges 属性。For more information, see the CommitChanges property.

DirectoryEntry 可用于访问从架构条目的正则项和一些,但并非所有的信息。DirectoryEntry can be used to access regular entries and some, but not all, information from schema entries.

Active Directory 域服务层次结构包含多达几个几千个节点。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 服务接口 (ADSI) 技术提供了如何以编程方式将这些对象添加到目录树。Active Directory Service Interfaces (ADSI) technology provides ways to programmatically add these objects to the directory tree.

若要在层次结构中创建目录项,请使用Children属性。To create a directory entry in the hierarchy, use the Children property. Children属性是一个集合,提供Add方法,你可以通过其来添加到当前绑定到的父节点之下直接集合节点。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. 若要使用属性缓存,请参阅UsePropertyCache属性。To use attribute caching, see the UsePropertyCache property.

与相关联的类DirectoryEntry组件可用于任何 Active Directory 域服务服务提供商。The classes associated with the DirectoryEntry component can be used with any of the Active Directory Domain Services service providers. 某些当前提供程序是 Internet 信息服务 (IIS)、 轻型目录访问协议 (LDAP)、 Novell NetWare 目录服务 (NDS) 和 WinNT。Some of the current providers are Internet Information Services (IIS), Lightweight Directory Access Protocol (LDAP), Novell NetWare Directory Service (NDS), and WinNT.

备注

假定您具有的 Active Directory 域服务之前使用此类有一个大致了解。It is assumed that you have a general understanding of Active Directory Domain Services before using this class. 有关详细信息,请参阅System.DirectoryServices命名空间概述。For more information, see the System.DirectoryServices namespace overview.

构造函数

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

初始化 DirectoryEntry 类的新实例。Initializes a new instance of the DirectoryEntry class.

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

初始化 DirectoryEntry 类的新实例,该类可绑定到指定的本机 Active Directory 域服务对象。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)

初始化 DirectoryEntry 类的新实例,该类将此实例绑定到位于指定路径的 Active Directory 域服务中的节点。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)

初始化 DirectoryEntry 类的新实例。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)

初始化 DirectoryEntry 类的新实例。Initializes a new instance of the DirectoryEntry class.

属性

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

获取 Active Directory 域服务层次结构中此节点的子项。Gets the child entries of this node in the Active Directory Domain Services hierarchy.

Container Container Container Container

获取 IContainer,它包含 ComponentGets the IContainer that contains the Component.

(Inherited from Component)
DesignMode DesignMode DesignMode DesignMode

获取一个值,用以指示 Component 当前是否处于设计模式。Gets a value that indicates whether the Component is currently in design mode.

(Inherited from Component)
Events Events Events Events

获取附加到此 Component 的事件处理程序的列表。Gets the list of event handlers that are attached to this Component.

(Inherited from Component)
Guid Guid Guid Guid

获取 DirectoryEntry 的 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

获取提供程序返回的 DirectoryEntry 的 GUID。Gets the GUID of the DirectoryEntry, as returned from the provider.

NativeObject NativeObject NativeObject NativeObject

获取本机 Active Directory 服务接口 (ADSI) 对象。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

获取 Active Directory 域服务层次结构中此项的父级。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

获取或设置此 DirectoryEntry 的路径。Gets or sets the path for this DirectoryEntry.

Properties Properties Properties Properties

获取此 DirectoryEntry 对象的 Active Directory 域服务属性。Gets the Active Directory Domain Services properties for this DirectoryEntry object.

SchemaClassName SchemaClassName SchemaClassName SchemaClassName

获取用于此 DirectoryEntry 对象的架构类的名称。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

获取或设置 ComponentISiteGets 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.

方法

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

关闭 DirectoryEntry 对象并释放与此组件关联的任何系统资源。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)

用指定的新名称创建 DirectoryEntry 对象的副本,并将其作为指定父级 DirectoryEntry 对象的子项。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()

从 Active Directory 域服务层次结构中删除此项及其整个子树。Deletes this entry and its entire subtree from the Active Directory Domain Services hierarchy.

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

释放由 Component 使用的所有资源。Releases all resources used by the Component.

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

释放 DirectoryEntry 使用的资源(内存除外)。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)

返回一个对象,该对象表示由 Component 或它的 Container 提供的服务。Returns an object that represents a service provided by the Component or by its Container.

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

获取当前实例的 TypeGets 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[])

对本机 Active Directory 域服务对象调用方法。Calls a method on the native Active Directory Domain Services object.

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

获取来自本机 Active Directory 域服务对象的属性。Gets a property from the native Active Directory Domain Services object.

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

设置本机 Active Directory 域服务对象上的属性。Sets a property on the native Active Directory Domain Services object.

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

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

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

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

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

将此 DirectoryEntry 对象移至指定父级。Moves this DirectoryEntry object to the specified parent.

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

将此 DirectoryEntry 对象移至指定父级,并将其名称变更为指定值。Moves this DirectoryEntry object to the specified parent and changes its name to the specified value.

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

将此 DirectoryEntry 对象的属性值加载到属性缓存中。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)

更改此 DirectoryEntry 对象的名称。Changes the name of this DirectoryEntry object.

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

返回包含 Component 的名称的 String(如果有)。Returns a String containing the name of the Component, if any. 不应重写此方法。This method should not be overridden.

(Inherited from Component)

事件

Disposed Disposed Disposed Disposed

当通过调用 Dispose() 方法释放组件时发生。Occurs when the component is disposed by a call to the Dispose() method.

(Inherited from Component)

安全性

DirectoryServicesPermission
LinkDemand

适用于