Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 DirectoryEntry.children problem

Author  Topic 

juicyapple
Posting Yak Master

176 Posts

Posted - 2008-03-23 : 09:16:32
Hi, I wrote a sub procedure to list out all users in few directory entry. But the code is something wrong because I get unknown error for second loop of For Each deUser In deAllUser.Children. Please advise.


Public Sub ListAllUser()
Dim i As Integer
Dim deAllUser As DirectoryEntry
Dim deUser As DirectoryEntry
Try
Dim objLDAP() As Object = ConfigurationManager.AppSettings("LDAP").Split("^")
For i = 0 To objLDAP.Length - 1
deAllUser = New DirectoryEntry(objLDAP(i).ToString)
For Each deUser In deAllUser.Children
lstMember.Items.Add(New ListItem(deUser.Properties("FullName").Value, deUser.Name))
Next
Next
Catch ex As Exception
Response.Write(ex.ToString)
End Try
End Sub
   

- Advertisement -