Re: How to get ou of an user

From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 05/25/05


Date: Wed, 25 May 2005 11:37:18 -0500

Yep, that works too. Thanks for pointing that out.

Joe K.

"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



Relevant Pages

  • Re: How to get ou of an user
    ... can you give a sample format please? ... > dl schrieb: ... > If you search the account by using the DirectorySearcher class, ... > you will get an object of type SearchResult. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: How to get ou of an user
    ... > - authentication ... Why parsing the dn when you can just ask the corresponding class? ... If you search the account by using the DirectorySearcher class, ...
    (microsoft.public.dotnet.framework.aspnet.security)