Search code examples
active-directoryldapldap-query

Fetch Email of multiple entities using DNs in a single query


I have DNs of 2 or more entities of my Ldap Server and need to fetch the email ids for them. Is there a way to do this in a single query. I looked at 'Extensible Match Search Filter) but couldn't figure out a way to do this.


Solution

  • Use the | OR operator to construct your query filter:

    (|(distinguishedName=<DN 1 goes here>)(distinguishedName=<DN 2 goes here>))
    

    You can add more clauses if necessary, as long as the resulting filter string is less than 10MB in size (~5 million characters)