Reputation: 263
I need to search users in active directory and apply 'contains' filter on two concatenated properties. So it should be something like:
(&(objectClass=user)(property1 + " " + property2=*keyword*))
Is it possible to achieve this with DirectorySearcher?
Upvotes: 1
Views: 4870
Reputation: 40938
No, you cannot do any concatenations in LDAP filters.
But you could split it up and check if either property contains a keyword:
(&(objectClass=user)(|(property1=*keyword*)(property2=*keyword*)))
Note that any searches that use a wildcard at the beginning can make the search perform very slowly since no indexes can be used to do that matching.
The documentation on how to construct LDAP queries is here.
Upvotes: 4