使用DirectorySearcher查询多个OU [英] Using DirectorySearcher to query multiple OUs
本文介绍了使用DirectorySearcher查询多个OU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码:
var directoryEntry = new DirectoryEntry(distributionListsListADSPath);
var directorySearcher = new DirectorySearcher(directoryEntry)
{ SizeLimit = int.MaxValue, PageSize = int.MaxValue };
var result = directorySearcher.FindAll();
问题是我要搜索两个单独的OU.
The problem is I want to search two seperate OUs.
所以我要做的是两次,一次完成
So what I do is run through this twice, once where
private const string distributionListsListADSPath =
"LDAP://OU=Distribution Lists,OU=Groups,DC=enron,DC=com";
及其所在位置的一秒
private const string distributionListsListADSPath =
"LDAP://OU=Security Groups,OU=Groups,DC=enron,DC=com";
理想情况下,我可以做类似
Ideally, I could do something like
private const string distributionListsListADSPath =
"LDAP://OU=Distribution Lists | OU = Security Groups ,OU=Groups,DC=enron,DC=com";
推荐答案
不了解容器的层次结构,就很难形成正确的答案.
Without knowing the hierarchy of your container, it is hard to form a proper answer.
您可能需要使用此处描述的可扩展匹配: http://ldapwiki.willeke.com /wiki/ExtensibleMatch
You may need to use Extensible Match which is described here: http://ldapwiki.willeke.com/wiki/ExtensibleMatch
祝你好运-吉姆
这篇关于使用DirectorySearcher查询多个OU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文