Last post Jan 18, 2011 05:15 AM by Ovianer
Jan 05, 2011 10:55 AM|Ovianer|LINK
I have wrote a web page to find and view special groups (only from a special OU) and show this result in a GridView.
If I try to view all groups I get always a part of all groups, but not all.
I know that this special OU has over 81000 group objects in it (showing in MMS Active Directory Users and Computers).
But my web page show me only 61855 objects. My code is very simple:
Dim _ADCon As New DirectoryEntry(LDAP://[my OU path])
Dim _ObjSearch As New DirectorySearcher(_ADCon)
Dim _ResultCollection As SearchResultCollection
_ObjSearch.Filter = "(&(objectclass=group))"
_ObjSearch.PageSize = Int32.MaxValue
_ObjSearch.SizeLimit = Int32.MaxValue
_ResultCollection = _ObjSearch.FindAll()
If _ResultCollection.Count > 0 Then
GridView1.DataSource = _ResultCollection
GridView1.EmptyDataText = "No result found"
I have already try to change the PageSize or SizeLimit settings, but it never changes my complete result.
The max. value I get alway back is 61855 objects.
Have anyone an idea why I can't get back all objects and how I must change my code to get all entries?
Jan 05, 2011 11:47 AM|karthic_85|LINK
I doubt the access level to the AD.The id your app is running should have admin rights to fetch all details.
Just a thought
Jan 05, 2011 05:07 PM|smirnov|LINK
- _ObjSearch.Filter = "(objectclass=group)" // no need to have double parenthesis
- PageSize is not necessary if you don't need to use paged search. When PageSize > 0 and < max page size, then SizeLimit is ignored.
- What is the reason to see 81,000 rows in the grid? Large non-paged searches eat up lots of server resources.
Maybe you can try to go through all groups using hierarchy (first show parent containers, then select one and show all groups below)
Jan 06, 2011 04:30 AM|Ovianer|LINK
I'm starting Visual Studio in Administrator Mode and my AD account have full access to this OU.
Otherwise I could not view all entries inside "Active Directory Users and Computers Console".
Jan 06, 2011 05:41 AM|Ovianer|LINK
I have removed Filter and PageSize; but it doesn't changed anything.
All group objects are lying in one OU. There are no parent or child OU's.
I have converted my code to a Wscript program. I get the same result (61855 entries).
And I have wrote a Powershell Script with the same result.
I'm assuming this is not a ASP.NET problem.
It should be an AD restriction.
Jan 07, 2011 06:26 AM|smirnov|LINK
If I run your code without filtering the groups I'm able to get >300.000 objects back. So, I suppose it's something related to configuration of your directory.
As an idea. You can make a loop from A to Z
and copy objects to the datatable
and then finally use that datatable in your grid.
Jan 07, 2011 08:16 AM|Ovianer|LINK
That's an idea. I will try it.
Jan 18, 2011 05:15 AM|Ovianer|LINK
This was not an ASP.NET failure.
Something was wrong inside AD. The count of object which I have found through ASP.NET was correct.