title: LDAP departmentnumber query
body: <p>I am attempting to query a list of users that are assigned to a specific <code>departmentnumber</code> in LDAP, which I know should be a list of about 100.  The below code only pulls back one member (which last name starts with T, so in my mind it seems like it's only returning the last value):</p>
  
  <pre><code>Dim userIds As IEnumerable(Of String) = {"7871"}
  For Each i As String In userIds
      Dim de As New DirectoryEntry("LDAP://test.net:389/DC=test,DC=net")
      Dim LdapFilter As String = "(departmentNumber=" &amp; i &amp; ")"
      Dim searcher As New DirectorySearcher(de, LdapFilter)
      Dim result As SearchResult = searcher.FindOne()
      Dim res As SearchResultCollection = searcher.FindAll()
      Dim item As ListViewItem = ListView1.Items.Add(i)
      item.SubItems.Add(result.Properties("givenName")(0).ToString())
      item.SubItems.Add(result.Properties("cn")(0).ToString())
      item.SubItems.Add(result.Properties("userPrincipalName")(0).ToString())
  Next
  </code></pre>