Re: How to get ou of an user

dl
Date: 05/27/05


Date: Fri, 27 May 2005 15:34:38 +0800

Thanks Jan. But what is returned by the GetDirectoryEntry().Parent.Path?
can you give a sample format please?
TIA

"Jan Peter Stotz" <jp_news@gmx.de> wrote in message
news:1o35o0xmyyeoe.1uwll7298ao41.dlg@40tude.net...
> dl schrieb:
>
> > Here is what I can think of
> > - authentication
> > - Search with SAMAccountName=<username entered>
> > - set PropertiesToLoad.Add("distinguishedName")
> > - parse the OU= string from the property returned
>
> Why parsing the dn when you can just ask the corresponding class?
>
> If you search the account by using the DirectorySearcher class, as result
> you will get an object of type SearchResult. Call on this object
> .GetDirectoryEntry().Parent.Path and you get what you want.
>
> Jan