我正在尝试使用server
来设置LDAP
字段,以便从票据中的交换人bearbeiter
获取可分辨的用户名,因此除该用户外,没有人可以访问该特定文档是在bearbeiter
字段中添加的。我尝试过其他类型的名称,例如cannonical
或abbreviated
,但没有用。我如何获得Distinguished name(DN)
交换用户的名称?
public String lookup(String searchedName) throws NotesException {
Vector<String> result = new Vector<String>();
String result = null;
try {
Session sess = DominoUtils.getCurrentSession();
Directory dir = sess.getDirectory();
dir.setSearchAllDirectories(true);
Vector<String> itemsToFetch = new Vector<String>();
itemsToFetch.add("FullName");
itemsToFetch.add("Mail");
Vector<String> namesToLookup = new Vector<String>();
namesToLookup.add(searchedName);
DirectoryNavigator dirnav = dir.lookupNames("($Users)",namesToLookup, itemsToFetch, true);
int count = 0;
while (dirnav.isNameLocated()) {
while (dirnav.isMatchLocated()) {
Vector<String> iv = dirnav.getNthItemValue(1);
String notesid =iv.get(0) ;
result=notesid;
dirnav.findNextMatch();
count += 1;
}
dirnav.findNextName();
}
dirnav.recycle();
dir.recycle();
sess.recycle();
return result;
} catch (Exception e) {
System.out.println("In Catch, error in lookup function inside DirectoryDelegatesPickerEws java class "+e.getStackTrace());
return result;
}
}