title: How to bind all users in an Active Directory to a dropdown list on a SharePoint site?
body: <p>I am trying to do what the topic describes and my code so far is:</p>
  
  <pre><code>DirectoryEntry directoryEntry = new DirectoryEntry("LDAP://myDomain/DC=somecollege, DC=someState, DC=edu", myUser, myPassword);
  DirectorySearcher directorySearcher = new DirectorySearcher(directoryEntry);
  directorySearcher.Filter = "(&amp;(objectCategory=Person))";
  
  SearchResultCollection searchResult = directorySearcher.FindAll();
  
  foreach (SearchResult srUSers in searchResult)
  {
      DirectoryEntry de = srUsers.GetDirectoryEntry();
      lbSiteOwnerGroups.Items.Addd(New ListItem(de.Name.ToString()));
  }
  </code></pre>
  
  <p>With this code all persons gets bound to a drop down but the format is:
  CN=lastName firstName
  How do I get only the names and not "CN=", I assume I should not need to you string manipulation here.</p>
  
  <p>If I try with de.Path.Tostring() it looks like:</p>
  
  <pre><code>&lt;option value="LDAP://myDomain/CN=DOE John, OU=IT, OU=_someville_NonTeaching, OU=Staff_someville, DC=somecollege, DC=nsw, DC=edu,DC=au"&gt;LDAP://myDomain/CN=DOE John, OU=IT, OU=Staff_someville_NonTeaching, OU=Staff_someville, DC=somecollege, DC=fl, DC=edu,DC=com&lt;option&gt;
  </code></pre>
  
  <p>I have seen I can use de.Properties["mail"].ToString() for example but gives me the error "operator has returned an error". I haven't worked with AD before and I if I get in contact with the AD administrator what questions should I ask him if the questions I have here needs answewer from the actual admin?</p>
  
  <p>Also, there is a subdomain or childdomain that's called Staff, how can I get users from this domain only?</p>
  
  <p>Thanks in advance.</p>