How do I list all LDAP groups?
To list all the groups in the directory, do a search for all possible objectClasses that a group could have, for example:
ldap.DN = "dc=JUNGLE";
//specify the attributes you'd like returned for each search result
//if no attributes are specified, all attributes will be returned
ldap.Attributes.Add(new LDAPAttribute("displayName"));
ldap.Attributes.Add(new LDAPAttribute("name"));
ldap.Attributes.Add(new LDAPAttribute("cn"));
ldap.Attributes.Add(new LDAPAttribute("ou"));
ldap.Attributes.Add(new LDAPAttribute("o"));
ldap.Attributes.Add(new LDAPAttribute("objectClass"));
ldap.Attributes.Add(new LDAPAttribute("member"));
ldap.Attributes.Add(new LDAPAttribute("memberUid"));
ldap.Attributes.Add(new LDAPAttribute("uniqueMember"));
ldap.Search("(|(|(|(objectClass=posixGroup)(objectClass=groupOfUniqueNames))
(objectClass=groupOfNames))(objectClass=group))");
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.