0
我已经使用JNDI创建了一个Active Directory客户端,该客户端能够查询属性以及修改现有属性。我需要修改“msExchHideFromAddressLists”以将其设置为false,但在尝试查询它时收到空指针异常。任何见解?谢谢使用JNDI修改“msExchHideFromAddressLists”Active Directory属性使用JNDI
String filter = "(&(objectCategory=user) (sAMAccountName=" + sAMAccountName + "))";
results = ctx.search(ou, filter, controls);
while(results.hasMore()) {
SearchResult searchResult = (SearchResult) results.next();
Attributes attributes = searchResult.getAttributes();
Attribute attr = attributes.get("msExchHideFromAddressLists");
String output = (String) attr.get();
}
您的代码好吗? – MJB
我刚刚添加了代码...谢谢。 – Thomas