Follow dasblinkenlight's advice, I use something like this to search for users where their common name wildcard matches a string. It follows all of the advice given and should demonstrate the type of thing you need to do
private List<ActiveDirectoryUser> GetDomainUsers(string name)
{
var userList = new List<ActiveDirectoryUser>();
using (var root = new DirectoryEntry(domainName))
{
using (var s = new DirectorySearcher(root))
{
s.Filter = String.Format("(&(objectCategory=Person)(cn=*{0}*))", name);
s.PropertiesToLoad.Add("cn");
s.PropertiesToLoad.Add("sAMAccountName");
s.PropertiesToLoad.Add("givenName");
s.PropertiesToLoad.Add("sn");
using (var results = s.FindAll())
{
for (int i = 0; i < results.Count; i++)
{
SearchResult result = results[i];
var user = new ActiveDirectoryUser(result);
userList.Add(user);
}
}
}
}
return userList;
}