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")]
[System.ComponentModel.TypeConverter(typeof(System.DirectoryServices.DirectoryEntryConverter))]
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 屬性 (Property)。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 Domain Services 階層包含多達數千個節點。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. 屬性 (property) 是Add提供方法的集合, 您可以透過它將節點加入至您目前所系結之父節點正下方的集合中。 ChildrenThe 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 Domain Services 服務提供者使用。The classes associated with the DirectoryEntry component can be used with any of the Active Directory Domain Services service providers. 某些目前的提供者為 Internet Information Services (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 Domain Services 進行一般瞭解。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

取得包含 IContainerComponentGets 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 Service Interfaces (ADSI) 物件。Gets the native Active Directory Service Interfaces (ADSI) object.

ObjectSecurity ObjectSecurity ObjectSecurity ObjectSecurity

取得或設定這個項目的安全性描述元 (Security Descriptor)。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)

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。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()

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。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 的淺層複本 (Shallow Copy)。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 名稱的 StringReturns 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

適用於