首页 > 解决方案 > 如何在笔记目录中使用 LDAP 通过可分辨名称获取 Exchange 服务器的用户

问题描述

我正在尝试从使用设置字段server的注释中的交换中获取用户的可分辨名称,因此除了在字段中添加的用户之外,没有人可以访问该特定文档。我尝试过其他类型的名称,例如或但那个剂量不工作。如何获取交换用户的名称?LDAPbearbeiterbearbeitercannonicalabbreviatedDistinguished 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;
    }
  }

标签: active-directoryldaplotus-noteslotus-dominodistinguishedname

解决方案


推荐阅读