Link to home
Start Free TrialLog in
Avatar of JB4375
JB4375Flag for United States of America

asked on

Populate a Drop Down List with Group Members Exception.......

I've done this in the past, and even got help with it here.  The difference, in this case, is that before the group name within the LDAP path was designated as OU=GroupName. The group I'm working with now is CN=GroupName.

It would follow that I could just change the existing code to CN=GroupName and that would fix it but the drop down list isn't populating. I'm hoping it's something trivial that I missed.

Thanks!!
Public Sub FillDropdown()
        Dim ldapPath As String = "LDAP://CN=GroupName,DC=Departments,DC=ad,DC=domain,DC=com"
        Dim de As New DirectoryEntry(ldapPath)
        Dim ds As New DirectorySearcher(de)
        ds.PageSize = 1000
        ds.Filter = "(objectCategory=User)"

        Dim colUsers As ArrayList
        colUsers = New ArrayList
        Dim result As SearchResult

        For Each result In ds.FindAll()
            colUsers.Add(result.Properties("cn")(0))
        Next result
        colUsers.Sort()
        DropDownList1.DataSource = colUsers
        DropDownList1.DataBind()
        de.Dispose()
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JB4375

ASKER

Thanks CC!!
Glad to help :-)