DirectorySearcher null comparison in filters
I am trying to find LDAP objects which don't 开发者_高级运维have any value in their "manager" property. What should be the filter string? I am trying with this to no avail:
"(&(objectClass=user)(objectCategory=person)(manager=NULL))"
Try this:
(&(objectClass=user)(objectCategory=person)(!(manager=*)))
!
is the "not" operator and *
is the LDAP wildcard so the above will do a search for any entry that doesn't have a value set for the manager
-attribute.
精彩评论