Export (0) Print
Expand All

DirectoryEntry.Parent Property

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

[Visual Basic]
Public ReadOnly Property Parent As DirectoryEntry
public DirectoryEntry Parent {get;}
public: __property DirectoryEntry* get_Parent();
public function get Parent() : DirectoryEntry;

Property Value

This entry's parent in the Active Directory hierarchy.


[Visual Basic, C#, C++] The following example searches a given DirectoryEntry and displays the Name and Parent of the result.

[Visual Basic] 
Dim myADSPath As String = _ 
Dim myDirectoryEntry As New DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword)

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

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

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

Console::WriteLine(S"Parent is :{0}", myDirectoryEntry->Parent->Path);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

DirectoryEntry Class | DirectoryEntry Members | System.DirectoryServices Namespace

© 2015 Microsoft