Directory Services

Navigating to the Parent Object

DirectoryEntry also has a Parent property used to navigate from the object to which you are connected to its parent object.

The following code example shows how to navigate to the parent object.

[C#]
DirectoryEntry parent = ent.Parent;
Console.WriteLine(parent.Name);
[Visual Basic .NET]
Dim parent As DirectoryEntry = entry.Parent
If (True) Then
	Console.WriteLine(parent.Name)
End If