Guest User

Untitled

a guest
Aug 1st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. Can't get users present in Domain users in Active directory?
  2. string sADPath = "LDAP://" + tbDomain.Text;
  3. string username = tbUsername.Text;
  4. string password = tbPassword.Text;
  5. DirectorySearcher mySearcher = new DirectorySearcher(directoryEntry);
  6.  
  7.  
  8. int MaxResults = Int32.MaxValue - 1;
  9.  
  10.  
  11. ComboBoxItem selectItem = (ComboBoxItem)ddlGroups.SelectedItem;
  12. String value = selectItem.Value;
  13.  
  14. mySearcher.Filter = ("(&(objectCategory=person)(objectClass=User)(memberOf=" + value + "))");
  15.  
  16. mySearcher.SearchScope = SearchScope.Subtree;
  17.  
  18.  
  19. foreach (SearchResult temp in mySearcher.FindAll())
  20. {
  21. }
Add Comment
Please, Sign In to add comment