[英]Fetch all users in active directory in a specified folder
I'm doing an application which needs to query active directory and I've been using ldap queries for that purpose. 我正在做一个需要查询活动目录的应用程序,为此我一直在使用ldap查询。
My problem is that I really cant use ou=People,dc=pisoftware,dc=com
because the People node name keeps changing because my department name have been changed a lot recently. 我的问题是我真的不能使用
ou=People,dc=pisoftware,dc=com
因为People节点名称一直在变化,因为我的部门名称最近已更改很多。 So in order to avoid the problem of having to do code change each time the name changes then I was wondering if there is any way to query by some sort of a folder id? 因此,为了避免每次名称更改时都必须进行代码更改的问题,我想知道是否可以通过某种文件夹ID进行查询?
For example, maybe I could do ouid=123456,dc=pisoftware,dc=com
例如,也许我可以做
ouid=123456,dc=pisoftware,dc=com
Why can't you do an ldap query which applies a filter to return back only the objectCategory=person. 为什么不能执行ldap查询,该查询应用过滤器以仅返回objectCategory = person。 You then could target that query at a search base DN, so that it can still return what you want even if the ou/People nodes get renamed/changed.
然后,您可以将该查询定位为搜索基础DN,这样即使ou / People节点被重命名/更改,它仍然可以返回所需的查询。 There is a really good guide to which shows you how to do all this and how the queries work here: http://www.rlmueller.net/ADOSearchTips.htm
有一个非常好的指南,向您展示了如何执行所有操作以及查询如何在此处进行: http : //www.rlmueller.net/ADOSearchTips.htm
Another thing you could do would be to move the search up the directory hierarchy far enough to encompass wherever the users may be and do: 您可以做的另一件事是将搜索向上移到目录层次结构的足够远的位置,以涵盖用户所在的位置和执行的操作:
myDirectorySearcher.SearchScope = SearchScope.SubTree;
which would then do a recursive sub-tree search throughout AD. 然后将在整个AD中进行递归子树搜索。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.