Kasper

Kasper

  • NA
  • 3
  • 0

"Basic" Manager lookup in AD

Feb 4 2010 6:07 AM

Hi developers and AD people! ;-)
I got some quite simple code for some AD lookup:
DirectorySearcher
sea = new DirectorySearcher();
sea.Filter = txt_SearchText.Text; (Here I put basic queries like "name=Tommy Jensen" or "surname=jen*")
SearchResult seares = sea.FindOne();
StringBuilder str = new StringBuilder();
System.DirectoryServices.
ResultPropertyCollection prop = seares.Properties;
ICollection coll = prop.PropertyNames;
IEnumerator enu = coll.GetEnumerator();
while (enu.MoveNext())
{
str.Append(enu.Current +
" = " + seares.Properties[enu.Current.ToString()][0] + "\n");
}
rtb_SearchResult.Text = str.ToString();
 
My question is:
How do I lookup a manager using wildcard (*) or looking up a adspath?
Can I write something like: "manager=CN=Tommy*" or "adspath=LDAP://CN=Tommy*" or am I totally misunderstanding some fundamentals?
What would a query saying "give me the name of all people whose manager is tommy*" look like?
 
Regards Kasper.

Answers (1)