3

我基本上是在尝试使用 DirectorySearcher 将我的结果过滤到一系列成员,但是这个过滤器不返回任何结果。

"(&(objectClass=user)(memberof=CN=Users,OU=myou,OU=base,OU=home,DC=gorge,DC=net)(member;range=0-1499))"

DirectoryEntry dEntryhighlevel = 
          new DirectoryEntry("LDAP://OU=base,OU=home,DC=gorge,DC=net");
DirectorySearcher dSeacher = 
          new DirectorySearcher(dEntryhighlevel);
dSeacher.Filter = 
        "(&(objectClass=user)
         (memberof=CN=Users,OU=myou,OU=base,OU=home,DC=gorge,DC=net)
         ("+attributeWithRange+"))";
dSeacher.PropertiesToLoad.Add(attributeWithRange);
dSeacher.PropertiesToLoad.Add("givenname");
dSeacher.PropertiesToLoad.Add("sn");
dSeacher.PropertiesToLoad.Add("samAccountName");
dSeacher.PropertiesToLoad.Add("mail");
dSeacher.PageSize = 1500;
SearchResultCollection resultCollection = resultCollection = dSeacher.FindAll();

此代码在没有范围过滤器的情况下工作得很好。这里的任何帮助都会很棒。

4

1 回答 1

0

I think your issue might be that you're trying to insert the range into the Filter as well as into the PropertiesToLoad. If you take a look at the first code example on this page you can see that the range is being added only to the PropertiesToLoad for the instance of the DirectorySearcher class.

于 2012-09-07T10:28:49.580 回答