0

I ran into a problem. The standard package for NetCor App System.DirectoryServices is not supported on Linux. It was decided to move to the Novell.Directory.Ldap.NETStandard.

In AD, there is a limit on 1000 search results. How to return more than 1000 results on a client using Novell.Directory.Ldap.NETStandard?

This my code. It returns only 1000 records.

LdapSearchQueue queue = connection.Search("<this my base entry>",
    LdapConnection.SCOPE_SUB,
    "<this my filter>",
    attr,
    false,
    (LdapSearchQueue)null,
    new LdapSearchConstraints { MaxResults = 0 });

LdapMessage message;
while ((message = queue.getResponse()) != null)
{
    if (message is LdapSearchResult)
    {
        LdapEntry entry = ((LdapSearchResult)message).Entry;

        LdapAttributeSet attributeSet = entry.getAttributeSet();

        var atr = attributeSet.getAttribute("sAMAccountName");
                        list.Add(atr.StringValue);
    }
}
Aleks Andreev
  • 7,016
  • 8
  • 29
  • 37
  • This was asked here too: https://stackoverflow.com/questions/44107354/novell-directory-ldap-netstandard-maxresults But the response was that it's not supported :( – Gabriel Luci May 23 '18 at 15:12

2 Answers2

0

I found the following solution

All users are in folders. And in each folder there are no more than 1000 users. The folder is the same object as the user, but with the other objectType.

First. Get a list of all folders with users. If in any folder there are also more than 1000 folders, then for this folder it is necessary to get the list of folders to the level below (LdapConnection.SCOPE_ONE).

The second. Go for each folder found and collect all the users in it.

With this approach, the number of search results on each iteration will not exceed 1000. If there is still such situation, that in one folder there are more than 1000 users, then you have PROBLEMS.

0

More than 1000 cannot be returned at a time. You need to organize loop. Use the LdapControl class (Novell.Directory.Ldap.NETStandard.dll). This is the author's Metacube repository with a good working example of the project.

https://github.com/metacube/PagedResultsControl

PhiseySt
  • 92
  • 10