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
[C#]
public DirectoryEntry Parent {get;}
[C++]
public: __property DirectoryEntry* get_Parent();
[JScript]
public function get Parent() : DirectoryEntry;

Property Value

This entry's parent in the Active Directory hierarchy.

Example

[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 = _ 
          "LDAP://onecity/CN=user,CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com"
Dim myDirectoryEntry As New DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword)

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

[C#] 
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);

[C++] 
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.

Requirements

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

Show:
© 2015 Microsoft