Search code examples
active-directoryldap

LDAP multiple locations


Is there a way to add multiple locations here? I need to do this for testing purposes and to add ldap filter on multiple locations. Currently, I only have one location. I would like to test with at least two locations.

<Employees FileFormat="LDAP"
             FilePath="LDAP://LDAPS.company:6367"
             Filter="(&amp;(objectClass=user)(objectCategory=person)(givenName=*)(sn=*)(mail=*)(PhysicalDeliveryOfficeName=Test Location))"
             FilterOptions="Subtree">

Solution

  • Use the LDAP "or" operator, which is |, like this:

    Filter="(&amp;(objectClass=user)(objectCategory=person)(givenName=*)(sn=*)(mail=*)(|(PhysicalDeliveryOfficeName=Test Location)(PhysicalDeliveryOfficeName=Test Location 2)(PhysicalDeliveryOfficeName=Test Location 3)))"
    

    More details about how to build LDAP queries is here: Active Directory: LDAP Syntax Filters