Directory Programming .NET

Active Directory and ADAM programming support for .NET developers
Welcome to Directory Programming .NET Sign in | Join | Help
in Search

Searching the directory for active users and contacts

Last post 08-03-2010, 9:25 AM by barry. 1 replies.
Sort Posts: Previous Next
  •  07-29-2010, 9:42 AM 8500

    Searching the directory for active users and contacts

    Hi,

    I'm using the query below to search for active users, I want to also pull back contacts, when I add (objectClass=contact) to the query it doesn't return anything. What am I doing wrong and can I do this in one query? Thanks

    (&(objectCategory=Person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))

    Many thanks
  •  08-03-2010, 9:25 AM 8503 in reply to 8500

    Re: Searching the directory for active users and contacts

    Contacts do not have objectClass=user, so you would need to OR these together to get both users and contacts in one query:

    (&(objectCategory=Person)(|(objectClass=user)(objectClass=contact))(!userAccountControl:1.2.840.113556.1.4.803:=2))
View as RSS news feed in XML