共用方式為


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 網域服務服務提供者使用。 目前的供應商包括網際網路資訊服務(IIS)、輕量目錄存取協定(LDAP)、Novell NetWare 目錄服務(NDS)及 WinNT。

備註

在「://」前標示提供者的部分 Path 是區分大小寫的。 例如,「LDAP://」或「WinNT://」。

該物業的 Path 語法會依提供者而異。 以下是一些常見的情節:

WinNT

  • 在電腦上連接一個群組。 例如,「WinNT:// <網域名稱>/<電腦名稱>/<群組名稱>」。 如果你是連接本地電腦,請用「WinNT:// <電腦名稱>/<群組名稱>」。

  • 連接電腦上的使用者。 例如,「WinNT:// <網域名稱>/<電腦名稱>/<使用者名稱>」。 如果你是連接本地電腦,請用「WinNT:// <電腦名稱>/<使用者名稱>」。

  • 連接電腦上的服務。 例如,「WinNT:// <網域名稱>/<電腦名稱>/<服務名稱>」。 如果你是連接本地電腦,請用「WinNT:// <電腦名稱>/<服務名稱>」。

  • 探索網路上的所有網域。 例如,「WinNT:」這些網域可以透過枚舉此條目的子節點來找到。

LDAP

  • 連接到網域中的群組。 例如,「LDAP://CN=<群組名稱>,CN =< 使用者>,DC=<網域元件>,DC=<網域元件>,...」。

  • 連接到網域中的使用者。 例如,「LDAP://CN=<完整使用者名稱>,CN=<使用者>,DC=<網域元件>,DC=<網域元件>,...」。

  • 連接網域內的電腦。 例如,「LDAP://CN=<電腦名稱>,CN=<電腦>,DC=<網域元件>,DC=<網域元件>,...」。

IIS

  • 連接到網路目錄。 例如,「IIS://LocalHost/W3SVC/1/ROOT/< Web 目錄名稱>」。

要使用 LDAP 綁定到目前的網域,請使用路徑「LDAP://RootDSE」,然後取得預設命名上下文並重新綁定該條目。 例如:

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

欲了解更多資訊,請參閱您的服務提供者文件及 「使用 Active Directory 服務介面 」條目。

適用於