U_T_A

I would like to search the active directory for the user login. I have the code to search for the employee ID which is like this:

System.DirectoryServices.DirectorySearcher mySearcher = new System.DirectoryServices.DirectorySearcher(entry);
mySearcher.Filter = ("(&(objectClass=user)(extensionattribute2=" + number + "))");

extensionattribute2 is the employee ID and i would like to know which one it is for the login.

Thank you in advance

Al


Re: Windows Forms General Active Directory Search

U_T_A

I just found a list of attributes, would the attribute that i am looking for be sAMAccountName

Thanks





Re: Windows Forms General Active Directory Search

U_T_A

GOT IT!!!

mySearcher.Filter = ("(&(objectClass=user)(displayname=" + fullName + "))");
SearchResult result = mySearcher.FindOne();
//returnName = result.Properties["mail"][0].ToString();
returnName = result.Properties["SAMAccountName"][0].ToString();