我有示例代码
Filter searchFilter = Filter.create("(sAMAccountType=805306368)");
SearchRequest searchRequest =
new SearchRequest(advanceBaseDnTxt.getText(), SearchScope.SUB, searchFilter,
ldapAttributeSet);
SearchResult searchResult = lcon.search(searchRequest);
是否足够用于检索所有用户以及如何排除某个部门?
答案 0 :(得分:1)
要取消LDAP过滤器上的属性,请查看此页面:http://www.ldapexplorer.com/en/manual/109010000-ldap-filter-syntax.htm
(!(department=<NUMBER TO EXCLUDE>))
应该使用
如果您需要对多个属性进行过滤,则从您的示例中,您需要每个条目sAMAccountType=805306368
且不在department=<NUMBER TO EXCLUDE>
中,因此过滤器将为:
(&(sAMAccountType=805306368)(!(department=<NUMBER TO EXCLUDE>)))