We can also get the properties by using the below code. This code is provided in wrox professional 2nd edition Active Directory folder.
public static void ShowUserObject()
{
using (DirectoryEntry de = new DirectoryEntry())
{
de.Path = "LDAP://celticrain/CN=Christian Nagel, OU=Wrox Press, " +
"DC=eichkogelstrasse, DC=local";
Console.WriteLine("Name: " + de.Name);
Console.WriteLine("GUID: " + de.Guid);
Console.WriteLine("Type: " + de.SchemaClassName);
Console.WriteLine();
Console.WriteLine("Properties: ");
PropertyCollection properties = de.Properties;
foreach (string name in properties.PropertyNames)
{
foreach (object o in properties[name])
{
Console.WriteLine(name + ": " + o);
}
}
}
}