DirectoryEntry.Path 屬性

定義

取得或設定這個 DirectoryEntry 的路徑。

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

屬性值

這個 DirectoryEntry 物件的路徑。 預設為空字串 ("")。

屬性

備註

屬性 Path 可在網路環境中唯一識別這個專案。 這個專案一律可以使用這個 Path來擷取。

設定 會 Path 從目錄存放區擷取新的專案;它不會變更目前系結項目的路徑。

與元件相關聯的DirectoryEntry類別可以與任何 Active Directory 網域服務 服務提供者搭配使用。 某些目前的提供者包括 Internet Information Services (IIS) 、輕量型目錄存取通訊協定 (LDAP) 、Novell NetWare Directory Service (NDS) 和 WinNT。

注意

識別提供者 (的 區段 Path 在 “://” ) 之前會區分大小寫。 例如,“LDAP://” 或 “WinNT://”。

屬性的 Path 語法會根據提供者而有所不同。 以下是一些常見的情節:

WinNT

  • 線上到電腦上的群組。 例如,“WinNT:// <domain name/<computer name>/<group name>>”。 如果您要連線到本機計算機,「WinNT:// <計算機名稱>/<組名>」。

  • 線上到電腦上的使用者。 例如,“WinNT:// <domain name/<computer name>>/<user name>”。 如果您要連線到本機計算機,「WinNT:// <計算機名稱>/<用戶名稱>」。

  • 線上到電腦上的服務。 例如,“WinNT:// <domain name/<computer name>>/<service name>”。 如果您要連線到本機計算機,「WinNT:// <計算機名稱>/<服務名稱>」。

  • 探索網路上的所有網域。 例如,您可以列舉這個專案的子系來找到 “WinNT:” 網域。

LDAP

  • 線上到網域中的群組。 例如,“LDAP://CN=<group name>, CN =<Users>, DC=<domain component, DC=<domain component>>,...”。

  • 線上到網域中的使用者。 例如,“LDAP://CN=<full user name>, CN=Users>, DC=<<domain component, DC=<domain component>>,...”。

  • 線上到網域中的電腦。 例如,“LDAP://CN=computer name>, CN=Computers>, DC=<<domain component, DC=<domain component>>,...”。<

IIS

  • 線上到 Web 目錄。 例如,“IIS://LocalHost/W3SVC/1/ROOT/< Web 目錄名稱>”。

若要使用LDAP系結至目前的網域,請使用路徑「LDAP://RootDSE」,然後取得預設命名內容並重新系結專案。 例如:

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

如需詳細資訊,請參閱提供者的檔和使用 Active Directory 服務介面 一文。

適用於