DirectoryEntry.Parent Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets this entry's parent in the Active Directory Domain Services hierarchy.

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

public DirectoryEntry Parent { get; }

Property Value

Type: System.DirectoryServices.DirectoryEntry

A DirectoryEntry object that represents the parent of this entry.

The following example searches a given DirectoryEntry and displays the Name and Parent of the result.

String myADSPath = "LDAP://onecity/CN=user,CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
DirectoryEntry myDirectoryEntry=new DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword);

Console.WriteLine("Parent is :"+myDirectoryEntry.Parent.Path);

.NET Framework
Available since 1.1
Return to top