Hi All,
Something weried happening when i try and return 4 AD properties to a listview box, here is my code:
Basically, if i only return the displayname, all the results come back, if i ask for the displayname and the mail as a subitem only 10 items come back, If i ask for department or homePhone to come back only 1 displayname is returned.
If i return the items to messageboxes they return fine.
Have i coded the subitems right on the listview?
Thanks,
James.
Something weried happening when i try and return 4 AD properties to a listview box, here is my code:
Code:
Dim li As ListViewItem
Dim dirEntry As DirectoryEntry = New DirectoryEntry("LDAP://172.16.0.3/OU=Staff,OU=Users,OU=Accounts,OU=Network,DC=X,DC=local")
dirEntry.Username = "x"
dirEntry.Password = "x"
Dim search As DirectorySearcher = New DirectorySearcher(dirEntry)
search.Filter = "(&(objectClass=User)(objectCategory=person))"
Dim res As SearchResultCollection = search.FindAll()
For Each ItemRes As SearchResult In res
li = Me.ListView1.Items.Add(ItemRes.Properties("displayname")(0).ToString())
li.SubItems.Add(ItemRes.Properties("department")(0).ToString())
li.SubItems.Add(ItemRes.Properties("homePhone")(0).ToString())
li.SubItems.Add(ItemRes.Properties("mail")(0).ToString())
Next
If i return the items to messageboxes they return fine.
Have i coded the subitems right on the listview?
Thanks,
James.
Comment