Posted on 2006-04-04
I am trying to retrieve all the entries from LDAP where Organizational unit is "Test Unit"
Here is the code I use:
Dim sPath As String = "LDAP://server1/DC=domain1,DC=com"
Dim sDir As New DirectoryEntry(sPath, "admin", "temp")
Dim sSearcher As New DirectorySearcher(sDir)
Dim sSearchResultColl As SearchResultCollection
Dim sSearchResult As SearchResult
'Build LDAP query
sSearcher.Filter = ("(&(ou=" & key & "))")
sSearchResultColl = sSearcher.FindAll()
Then if I check sSearchResultColl.Count, I get 1 even though there are at least 4 entruies wher OU is "Test Unit"
What am I doing wrong?