通过LDAP 读取 Lotus Domino 中用户的信息的时候,只能读出来dominoPerson的几个属性,如下表所示.
cn : 王五
givenname : wang
sn : wu
uid : wangwu
objectclass : dominoPerson
为什么其它的属性都读不出来呢?
急急??

解决方案 »

  1.   

    相关代码如下:using(DirectoryEntry root=new DirectoryEntry("LDAP://192.168.0.25","username","password",AuthenticationTypes.Anonymous))
    {
    try
    {
    DirectorySearcher search=new DirectorySearcher(root);
    search.Filter="(objectClass=dominoPerson)";
    search.PropertiesToLoad.Add("cn");
    SearchResultCollection rs=search.FindAll();
    foreach(SearchResult r in rs)
    {
    foreach (String propName in r.Properties.PropertyNames)
    {
    foreach (String s in r.Properties[propName])
    {
    this.txtOutPut.AppendText(propName+" : "+s+"\n\t");
    }

    }
    }
    rs.Dispose();
    }
    catch(Exception ex)
    {
    this.textBox1.Text=ex.ToString();
    }
    }注意:登陆是用的:AuthenticationTypes.Anonymous
    如果改成: AuthenticationTypes.Delegation
    会出错,错误提示如下:
    System.Runtime.InteropServices.COMException (0x80072032): 指定了一个无效的 dn 语法。
       at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
       at System.DirectoryServices.DirectoryEntry.Bind()
       at System.DirectoryServices.DirectoryEntry.get_AdsObject()
       at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
       at System.DirectoryServices.DirectorySearcher.FindAll()
       at SyncOU.Form2.button1_Click(Object sender, EventArgs e) in f:\databack\sync\src\winform\form2.cs:line 109
      

  2.   

    晕,没有人回答。这两看了一看书,书上说要配置允许通过LDAP访问。
    第一次接 Lotus Domino 很多东西还都不知道,明天现去看一看书。