I am trying to get Distinguished name of users from exchange server
in notes using LDAP
to set bearbeiter
field,so no one will have access on that particular document except the users which are added in bearbeiter
field.I have tried other types of names like cannonical
or abbreviated
but that dosen't work. How can i get Distinguished name(DN)
name of exchange users?
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;
}
}