来自活动领域的所有用户 [英] all users from active diractory

查看:73
本文介绍了来自活动领域的所有用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

在这里,我创建代码以从Active Directory中获取所有用户
我不知道那里出了什么问题


hi to all!

Here I create code to get all users from Active Directory
I dont know whats the problem there


try
{
   string path = "LDAP://usihgdgfui";
   string filter = "(&(objectCategory=person))";
   string[] propertiesToLoad = new string[1] { "name" };

   using (DirectoryEntry root = new DirectoryEntry(path, "xx\\xxxx", "xxxx"))
   using (DirectorySearcher searcher = new DirectorySearcher(root, filter, propertiesToLoad))
   using (SearchResultCollection results = searcher.FindAll())
   {
      foreach (SearchResult result in results)
      {
         string name = (string)result.Properties["name"][0];
                        
         comboBox1.Items.Add(name);
      }
   }
}
catch
{
}

推荐答案

未获得您期望的结果吗?得到奇怪的偶数个结果?像是有一些内置的限制吗?

查看searcher.PageSize属性.

将其设置为25000,然后看看会发生什么.
Not getting as many results as you expect? Getting a strangely even number of results? Like there''s some sort of built-in limit?

Look at the searcher.PageSize property.

Set it to, say 25000 and see what happens.


这篇关于来自活动领域的所有用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆