Export (0) Print
Expand All

DirectoryEntry.Parent Property

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft