Re: How to get ou of an user

dl
Date: 05/26/05

  • Next message: [MSFT]: "RE: Quering PrincipalSecurityAttributes on class"
    Date: Thu, 26 May 2005 09:41:15 +0800
    
    

    Thanks Joe.

    "Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
    in message news:es3VV7SYFHA.1204@TK2MSFTNGP10.phx.gbl...
    > 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:%230OTdVRYFHA.3712@TK2MSFTNGP09.phx.gbl...
    > > 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
    > >
    > > --
    > >
    > >
    > >
    >
    >


  • Next message: [MSFT]: "RE: Quering PrincipalSecurityAttributes on class"