Export (0) Print
Expand All

DirectoryEntry.DirectoryEntry(String) Constructor

Initializes a new instance of the DirectoryEntry class that binds this instance to the node in Active Directory located at the specified path.

Namespace: System.DirectoryServices
Assembly: System.DirectoryServices (in system.directoryservices.dll)

public DirectoryEntry (
	string path
)
public DirectoryEntry (
	String path
)
public function DirectoryEntry (
	path : String
)
Not applicable.

Parameters

path

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

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.

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

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft