I am trying to learn how to pull user names and user role groups from active directory on my home local computer. Can this be done?
If so, what would my domain path be for the below code?
try
{
List<UserAdDTO> lstADUsers = new List<UserAdDTO>();
string DomainPath = "LDAP://DC=xxxx,DC=com";
DirectoryEntry searchRoot = new DirectoryEntry(DomainPath);
DirectorySearcher search = new DirectorySearcher(searchRoot);
search.Filter = "(&(objectClass=user)(objectCategory=person))";
search.PropertiesToLoad.Add("samaccountname");
search.PropertiesToLoad.Add("mail");
search.PropertiesToLoad.Add("usergroup");
search.PropertiesToLoad.Add("displayname");//first name
SearchResult result;
...
Go to the complete details ...