dsbenghe / Novell.Directory.Ldap.NETStandard

.NET LDAP client library for .NET Standard >= 2.0, .NET Core >=1.0, NET5/NET6/NET7/NET8 - works with any LDAP protocol compatible directory server (including Microsoft Active Directory).
MIT License
555 stars 151 forks source link

Paged search examples #185

Closed chrisrrowland closed 2 years ago

chrisrrowland commented 2 years ago

I have tried using both SimplePagedResultsControlHandler and VirtualListViewControlHandler and my expectation was that each of these would return list with the entirety of the search results. What I'm actually getting in both cases is a list with 1500 elements, which as I understand is the max result size for the server.

                ////SimplePagedResultsControlHandler
                var pageControlHandler = new SimplePagedResultsControlHandler(conn);
                List<LdapEntry> rows = pageControlHandler.SearchWithSimplePaging(options, pageSize: 1000);
                //VirtualListViewControlHandler
                var vlvControlHandler = new VirtualListViewControlHandler(conn);
                var sortControl = new LdapSortControl(new LdapSortKey("cn"), true);
                List<LdapEntry> rows = vlvControlHandler.SearchUsingVlv(sortControl, options, 1000);
dsbenghe commented 2 years ago

Tests are the best example currently. Don't know from where your 1500 is coming, but I have run it with a lot larger results.

chrisrrowland commented 2 years ago

It turns out my issue was that I was getting back a single object but the attribute list was too large. I ended up manually paging the attributes by tweaking the request. I'm not sure if this is something weird in the LDAP world or if it's something this library could handle automatically and I just didn't see how.

I have very limited understanding of ldap so it's even difficult to describe my issue :-p