Reputation: 929
I am using LDAP search to find users and groups in active directory.
here is my search filter:
string Filter = "(|(&(objectCategory=user)(objectClass=person)(SAMAccountName=*))(&(objectCategory=group)(sAMAccountName=*)))";
I get a SearchResponse and I want to decide for every SearchResultEntry if it is a user or a group.
Is there an attribute I can check in order to decide if it is a user or a group?
Thanks, Inbal
Upvotes: 1
Views: 540
Reputation: 11026
There are several types of "users" and groups within AD.
However something like this should be close: if ((objectCategory=user)&&(objectClass=person)) { this is a user } else if ((objectClass=group)) { this is a group } else { this is not a user or a group }
You might find http://ldapwiki.willeke.com/wiki/LDAP%20Query%20Examples%20for%20AD useful.
-jim
Upvotes: 1