I use the folowing code to query an ldap server and capture a certain value.
DirectoryEntry entry = new DirectoryEntry("LDAP://server.domain.com/ou=users,o=intranet", "cn=username,ou=users,o=intranet", "password", AuthenticationTypes.ServerBind);
DirectorySearcher mySearcher = new DirectorySearcher Go to the complete details ...