create the funciton , HERE
DirectoryEntry entry
is actually the LDAP Setting and in the
search.PropertiesToLoad.Add("samAccountName");
you can load what ever information you need from AD like First Name , LastName and Country
object obj = entry.NativeObject;
string filterCriteria = "(&(objectCategory=user)(objectClass=person)(sAMAccountName=" + + "))";
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = filterCriteria;
search.PropertiesToLoad.Add("samAccountName");
SearchResult result = search.FindOne();
if (result == null)
{
}
}