DirectoryEntry Constructors

Definition

Initializes a new instance of the DirectoryEntry class.

Overloads

DirectoryEntry()

Initializes a new instance of the DirectoryEntry class.

DirectoryEntry(Object)

Initializes a new instance of the DirectoryEntry class that binds to the specified native Active Directory Domain Services object.

DirectoryEntry(String)

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)

Initializes a new instance of the DirectoryEntry class.

DirectoryEntry(String, String, String, AuthenticationTypes)

Initializes a new instance of the DirectoryEntry class.

DirectoryEntry()

Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs

Initializes a new instance of the DirectoryEntry class.

C#
public DirectoryEntry();

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

DirectoryEntry(Object)

Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs

Initializes a new instance of the DirectoryEntry class that binds to the specified native Active Directory Domain Services object.

C#
public DirectoryEntry(object adsObject);

Parameters

adsObject
Object

The name of the native Active Directory Domain Services object to bind to.

Remarks

This constructor enables a program to use the methods and properties of the DirectoryEntry class on a native Active Directory Domain Services object that implements the IADs interface through a native API. For more information about the IADs interface, see the IADs article.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

DirectoryEntry(String)

Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs

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.

C#
public DirectoryEntry(string? path);
C#
public DirectoryEntry(string path);

Parameters

path
String

The path at which to bind the DirectoryEntry(String) to the directory. The Path property is initialized to this value.

Examples

The following example binds a DirectoryEntry object to the directory entry at the specified path, and displays the Path property of each child entry that is specified by the node's Children property.

C#
public class PrintChildren{
   public static void Main(String[] args)
   {
      DirectoryEntry objDE;
      String strPath="LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com";
      if(args.Length>0)strPath=args[1];

      // Create a new DirectoryEntry with the given path.
      objDE=new DirectoryEntry(strPath);

      foreach(DirectoryEntry objChildDE in objDE.Children)
        Console.WriteLine(objChildDE.Path);
   }
 }

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

DirectoryEntry(String, String, String)

Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs

Initializes a new instance of the DirectoryEntry class.

C#
public DirectoryEntry(string? path, string? username, string? password);
C#
public DirectoryEntry(string path, string username, string password);

Parameters

path
String

The path of this DirectoryEntry. The Path property is initialized to this value.

username
String

The user name to use when authenticating the client. The Username property is initialized to this value.

password
String

The password to use when authenticating the client. The Password property is initialized to this value.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

DirectoryEntry(String, String, String, AuthenticationTypes)

Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs
Source:
DirectoryEntry.cs

Initializes a new instance of the DirectoryEntry class.

C#
public DirectoryEntry(string? path, string? username, string? password, System.DirectoryServices.AuthenticationTypes authenticationType);
C#
public DirectoryEntry(string path, string username, string password, System.DirectoryServices.AuthenticationTypes authenticationType);

Parameters

path
String

The path of this DirectoryEntry. The Path property is initialized to this value.

username
String

The user name to use when authenticating the client. The Username property is initialized to this value.

password
String

The password to use when authenticating the client. The Password property is initialized to this value.

authenticationType
AuthenticationTypes

One of the AuthenticationTypes values. The AuthenticationType property is initialized to this value.

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10