Hi there,
having a problem getting a complete users list out of AD. Code used in component:
oRoot = New DirectoryEntry("LDAP://LDAPServer/DC=domain,DC=com")
oSearcher = New DirectorySearcher(oRoot)
Dim strFilter As String
strFilter += "(&"
strFilter += "(objectCategory=CN=Person,CN=Schema,CN=Configurat ion,DC=rayaust,DC=au,DC=ray,DC=com)"
strFilter += "(samAccountName=*)"
strFilter += "(mail=*)"
strFilter += "(|"
strFilter += "(sn=*)"
strFilter += "(GivenName=*)"
strFilter += ")"
strFilter += ")"
oSearcher.Filter = (strFilter)
oResults = oSearcher.FindAll
Then in the VB.NET of the page:
Me.DsOwnerAD1 = comAD.GetAllUsers()
Dim dv As New DataView(Me.DsOwnerAD1.tblOwnerDetails())
Dim Row As dsOwnerAD.tblOwnerDetailsRow
dv.Sort = "Lastname"
For Each Row In dv.Table.Rows
If Not Row.LastName.ToString = "" Then
Dim Item As String
Dim Item2 As String
Item = Row.LastName.Trim + ", " + Row.FirstName.Trim
Item2 = Row.OwnerAD
Me.lbOwnerADs.Items.Add(New ListItem(Item, Row.FirstName))
End If
Next
Any ideas? I have played with the filter and got slightly different list, but never complete.
Many thanks.