title: How do I get the users that belong to a group in Active Directory?
body: <p>I have a dropdownlist that I am trying to fill with users that belong to a certain group in Active Directory.</p>
  
  <p>The group name is OverRiders and 8 people are members of this group. More members could be added.</p>
  
  <p>I have the following dropdown but I run the code, the dropdown is blank.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Please see code:</p>
  
  <pre><code>        Private Sub FillDropdown()
      Dim oroot As DirectoryEntry = New DirectoryEntry("LDAP://CN=OverRiders,OU=Departments,DC=domain,DC=com")
  Dim osearcher As DirectorySearcher = New DirectorySearcher(oroot)
  Dim oresult As SearchResultCollection
  Dim result As SearchResult
  Dim list As New List(Of String)
  
      osearcher.Filter = "(&amp;(objectCategory=group)(cn={0}))"
      ' search filter; only display emp with firstname / lastname pair
      osearcher.PropertiesToLoad.Add("name") ' member
      oresult = osearcher.FindAll()
  
  
      For Each result In oresult
          If Not result.GetDirectoryEntry.Properties("name").Value Is Nothing Then
              list.Add(result.GetDirectoryEntry.Properties("name").Value.ToString())
              Call list.Sort()
          End If
  Next
  emplist.DataSource = list
  emplist.DataBind()
  
  End Sub
  </code></pre>
  
  <p>I have been able to confirm that the group does exist and the group name is valid.
  Thanks a lot in advance</p>