Hi
Is this what you want?
We can use Properties to get the different property.
NOTE: we can not guarantee all the myChildDirectoryEntry has the following
properties, so we use the On Error Resume Next.
Imports System.DirectoryServices
Module Module1
Sub Main()
On Error Resume Next
Dim myADSPath As String =
"LDAP://servername:636/dc=ccs,dc=nrl,dc=navy,dc=mil"
' Creates an Instance of DirectoryEntry.
Dim myDirectoryEntry As New DirectoryEntry(myADSPath)
' Display the 'SchemaClassName'.
Console.WriteLine("Schema class name:" + myDirectoryEntry.Name)
Dim scn = myDirectoryEntry.SchemaClassName
' Gets the SchemaEntry of the ADS object.
Dim mySchemaEntry As DirectoryEntry = myDirectoryEntry.SchemaEntry
Dim myChildDirectoryEntry As DirectoryEntry
For Each myChildDirectoryEntry In myDirectoryEntry.Children
Console.WriteLine(myChildDirectoryEntry.Name)
Console.WriteLine(" " +
myChildDirectoryEntry.Properties("cn").Value.ToString())
Console.WriteLine(" " +
myChildDirectoryEntry.Properties("uid").Value.ToString())
Console.WriteLine(" " +
myChildDirectoryEntry.Properties("title").Value.ToString())
Console.WriteLine(" " +
myChildDirectoryEntry.Properties("telephoneNumber").Value.ToString())
Console.WriteLine(" " +
myChildDirectoryEntry.Properties("sn").Value.ToString())
Console.WriteLine(" " +
myChildDirectoryEntry.Properties("site").Value.ToString())
Console.WriteLine(" " +
myChildDirectoryEntry.Properties("roomNumber").Value.ToString())
Console.WriteLine(" " +
myChildDirectoryEntry.Properties("givenName").Value.ToString())
Console.WriteLine(" " +
myChildDirectoryEntry.Properties("mail").Value.ToString())
Next myChildDirectoryEntry
End Sub
End Module
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.