The distinction you need is made in the
objectClass
property.
When doing a search for a specific class of entries, you need to be more specific when setting the
Filter
property. This is what we use:
Contacts: "(&(objectClass=Contact)(objectCategor=Person))"
Employees: "(&(objectClass=User)(company=*))"
Users: "(objectClass=User)"
Groups: "(objectClass=Group)"
Computers: "(objectClass=Computer)"
Searching on these filters will return all contacts, users, groups or computers. We manually set the entry's
company
property to distinguish between actual employee users and non-employee contractors who have access to our network. Use
search.FindAll
and iterate through the results.
Note that when using more than one criteria (as with Contacts and Employees), you must use prefix notation: the
&
goes before the two statements being combined.