NET AD查询

由于工作需要,我需要遍历AD进行一些同步操作.

遍历的代码如下.

DirectorySearcher adSearcher = new DirectorySearcher(); Dictionary userConfigs = new Dictionary(); adSearcher.SearchRoot = new DirectoryEntry("LDAP://OU=组织架构,DC=****,DC=com", "****", "****"); adSearcher.Filter = "(objectclass=user)";

但是总是不能正确的返回所有的结果,而只返回1000个用户

解决方案是:
adSearcher.SizeLimit = Int32.MaxValue;
adSearcher.PageSize = Int32.MaxValue;

posted @ 2009-11-03 10:14  ~洛书~  阅读(300)  评论(0编辑  收藏  举报