G
Guest
hi all
I am trying to get list of employees in an organization based on the lastname, firstname. Things work fine if i give either firstname or lastname but stops working if i give lastname,firstname
string uname="ba,joh"
string filter="(&(anr=" + uname + ")(|(objectCategory=organizationalPerson)(objectCategory=group)))";
DirectoryEntry entry=new DirectoryEntry("GC://something")
DirectorySearcher dsearch=new DirectorySearcher(entry)
dsearch.Filter=filter
SearchResultCollection result =dsearch.FindAll();
foreach(SearchResult res in result
MessageBox.Show(res.Properties["cn"][0].ToString())
Any idea why the code breaks?? Any help is much appreciated.
thanks in advance
Rav
I am trying to get list of employees in an organization based on the lastname, firstname. Things work fine if i give either firstname or lastname but stops working if i give lastname,firstname
string uname="ba,joh"
string filter="(&(anr=" + uname + ")(|(objectCategory=organizationalPerson)(objectCategory=group)))";
DirectoryEntry entry=new DirectoryEntry("GC://something")
DirectorySearcher dsearch=new DirectorySearcher(entry)
dsearch.Filter=filter
SearchResultCollection result =dsearch.FindAll();
foreach(SearchResult res in result
MessageBox.Show(res.Properties["cn"][0].ToString())
Any idea why the code breaks?? Any help is much appreciated.
thanks in advance
Rav