Breyta

Deila með


DirectoryEntry.Path Property

Definition

Gets or sets the path for this 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

Property Value

The path of this DirectoryEntry object. The default is an empty string ("").

Attributes

Remarks

The Path property uniquely identifies this entry in a networked environment. This entry can always be retrieved using this Path.

Setting the Path retrieves a new entry from the directory store; it does not change the path of the currently bound entry.

The classes associated with the DirectoryEntry component can be used with any of the Active Directory Domain Services service providers. Some of the current providers are Internet Information Services (IIS), Lightweight Directory Access Protocol (LDAP), Novell NetWare Directory Service (NDS), and WinNT.

Note

The section of the Path that identifies the provider (precedes "://") is case-sensitive. For example, "LDAP://" or "WinNT://".

The syntax for the Path property varies according to the provider. Some common scenarios are:

WinNT

  • Connect to a group on a computer. For example, "WinNT://<domain name>/<computer name>/<group name>". If you are connecting to a local computer, "WinNT://<computer name>/<group name>".

  • Connect to a user on a computer. For example, "WinNT://<domain name>/<computer name>/<user name>". If you are connecting to a local computer, "WinNT://<computer name>/<user name>".

  • Connect to services on a computer. For example, "WinNT://<domain name>/<computer name>/<service name>". If you are connecting to a local computer, "WinNT://<computer name>/<service name>".

  • Discover all domains on the network. For example, "WinNT:" The domains can be found by enumerating the children of this entry.

LDAP

  • Connect to a group in a domain. For example, "LDAP://CN=<group name>, CN =<Users>, DC=<domain component>, DC=<domain component>,...".

  • Connect to a user in a domain. For example, "LDAP://CN=<full user name>, CN=<Users>, DC=<domain component>, DC=<domain component>,...".

  • Connect to computers in a domain. For example, "LDAP://CN=<computer name>, CN=<Computers>, DC=<domain component>, DC=<domain component>,...".

IIS

  • Connect to a Web directory. For example, "IIS://LocalHost/W3SVC/1/ROOT/<Web directory name>".

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);

For more information, see the documentation for your provider and the Using Active Directory Service Interfaces article.

Applies to