本文介绍了来自活动领域的所有用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好! 在这里,我创建代码以从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.
更多推荐
来自活动领域的所有用户
发布评论