That will probably work fine. You might also consider p/invoking the
TranslateName Windows API as it can convert from login name to distinguished
name.
If you do parse, be careful about encoded "," characters in the DN. You
can't be 100% sure that a simple Split on the comma will work as the name
component can have a "," in it if it is preceded by "\". Thus you could
have:
CN=Doe\, Jane,OU=people,DC=domain,DC=com
If your AD doesn't use that naming convention, you are fine, but just
remember that it is legal syntax and could cause funny bugs at runtime in
code that seems to work fine 95% of the time.
Joe K.
<dl> wrote in message news:%...
> Hi
> I wonder if there is other / faster ways to get ou of the login user?
>
> 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
>
> TIA
>
> --
>
>
>
|