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