Reading LDAP(OpenLDAP) Schema from c#

880 views Asked by At

I want to get all the available objectclass names and attributes of every objectclass from OpenLDAP (not Active Directory) using c#.

I am able to do this with the ActiveDirectorySchema class when dealing with AD, But i don't know how to do it with other LDAP server.

Can anyone please help?

1

There are 1 answers

1
jwilleke On

You need to query the rootDSE and retrieve the value for the "subschemaSubentry" attribute. (cn=schema for openLDAP).

Then query the value from the subschemaSubentry as base and (objectClass=*)

Example shows here.

If you want ONLY objectClasses (which will include the attributes within the objectClasses) use something like:

ldapsearch -h yourLDAPDNS  -b "cn=schema" -s base -D cn=admin,ou=...,dc=yourdomain,dc=com -w secretpassword "(objectclass=*)"  objectClasses