我正在尝试连接到 Domino 服务器以获取所有用户信息(姓名、电子邮件等)。当我尝试运行以下代码时,出现以下错误:{“发生协议错误。\r\n”}
我环顾四周并在 ldap 浏览器中尝试了相同的查询,一切正常。任何建议表示赞赏。
DirectorySearcher search = new DirectorySearcher(new DirectoryEntry("LDAP://server:port"));
try
{
search.Filter = "(objectClass=dominoPerson)";
search.PropertiesToLoad.Add("cn");
SearchResultCollection results = search.FindAll();
foreach (SearchResult r in results)
{
DirectoryEntry de = r.GetDirectoryEntry();
foreach (DirectoryEntry child in de.Children)
{
Console.WriteLine(child.Name);
}
}
search.Dispose();
}
catch (Exception msg)
{
Console.WriteLine(msg.ToString());
}v