DirectoryEntry.Path 屬性

定義

取得或設定這個 DirectoryEntry 的路徑。Gets or sets the path for this DirectoryEntry.

public:
 property System::String ^ Path { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.SettingsBindable(true)]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.DirectoryServices.DSDescription("DSPath")]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string Path { get; set; }
member this.Path : string with get, set
Public Property Path As String

屬性值

這個 DirectoryEntry 物件的路徑。The path of this DirectoryEntry object. 預設為空字串 ("")。The default is an empty string ("").

屬性

備註

Path屬性可在網路環境中唯一識別此專案。The Path property uniquely identifies this entry in a networked environment. 此專案一律可使用此Path來抓取。This entry can always be retrieved using this Path.

Path設定會從目錄存放區抓取新的專案,而不會變更目前系結專案的路徑。Setting the Path retrieves a new entry from the directory store; it does not change the path of the currently bound entry.

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.

注意

識別提供者之Path的區段(在 "://" 之前)會區分大小寫。The section of the Path that identifies the provider (precedes "://") is case-sensitive. 例如,"LDAP://" 或 "WinNT://"。For example, "LDAP://" or "WinNT://".

Path屬性的語法會根據提供者而有所不同。The syntax for the Path property varies according to the provider. 以下是一些常見的情節:Some common scenarios are:

WinNTWinNT

  • 連接到電腦上的群組。Connect to a group on a computer. 例如,「WinNT:// <功能變數名稱 >/<電腦名稱稱 >/<組名 >」。For example, "WinNT://<domain name>/<computer name>/<group name>". 如果您要連接到本機電腦,請將「WinNT:// <電腦名稱稱 ></組名 >」。If you are connecting to a local computer, "WinNT://<computer name>/<group name>".

  • 連接到電腦上的使用者。Connect to a user on a computer. 例如,「WinNT:// <功能變數名稱 >/<電腦名稱稱 >/<使用者名稱 >」。For example, "WinNT://<domain name>/<computer name>/<user name>". 如果您要連接到本機電腦,請將「WinNT:// <電腦名稱稱 ></使用者名稱 >」。If you are connecting to a local computer, "WinNT://<computer name>/<user name>".

  • 連接到電腦上的服務。Connect to services on a computer. 例如,「WinNT:// <功能變數名稱 >/<電腦名稱稱 >/<服務名稱 >」。For example, "WinNT://<domain name>/<computer name>/<service name>". 如果您要連接到本機電腦,請將「WinNT:// <電腦名稱稱 ></服務名稱 >」。If you are connecting to a local computer, "WinNT://<computer name>/<service name>".

  • 探索網路上的所有網域。Discover all domains on the network. 例如,"WinNT:"藉由列舉此專案的子系,可以找到這些網域。For example, "WinNT:" The domains can be found by enumerating the children of this entry.

LDAPLDAP

  • 連接到網域中的群組。Connect to a group in a domain. 例如<,「LDAP://CN = 組名 >,CN =<Users >,dc =<domain component >,DC =<domain component >,...」。For example, "LDAP://CN=<group name>, CN =<Users>, DC=<domain component>, DC=<domain component>,...".

  • 連接到網域中的使用者。Connect to a user in a domain. 例如,"LDAP://CN<= full user name >,CN =<Users >,dc =<domain component >,dc =<domain component >,..."。For example, "LDAP://CN=<full user name>, CN=<Users>, DC=<domain component>, DC=<domain component>,...".

  • 連接到網域中的電腦。Connect to computers in a domain. 例如<,「LDAP://CN = 電腦名稱稱 >,CN =<電腦 >,dc =<domain component >,DC =<domain component >,...」。For example, "LDAP://CN=<computer name>, CN=<Computers>, DC=<domain component>, DC=<domain component>,...".

IISIIS

  • 連接到 Web 目錄。Connect to a Web directory. 例如,「IIS://LocalHost/W3SVC/1/ROOT/<Web 目錄名稱 >」。For example, "IIS://LocalHost/W3SVC/1/ROOT/<Web directory name>".

若要使用 LDAP 系結至目前的網域,請使用 "LDAP://RootDSE" 路徑,然後取得預設命名內容,並重新系結專案。To bind to the current domain using LDAP, use the path "LDAP://RootDSE", then get the default naming context and rebind the entry. 例如:For example:

String str = ent.Properties["defaultNamingContext"][0];  
DirectoryEntry domain = new DirectoryEntry("LDAP://" + str);  

如需詳細資訊,請參閱提供者的檔和使用 Active Directory 的服務介面一文。For more information, see the documentation for your provider and the Using Active Directory Service Interfaces article.

適用於