How to get attribute type from Active Directory

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shashank kadge

    How to get attribute type from Active Directory

    hello experts,
    I want to get attribute type (whether single value or multivalue) from
    AD forest/domain.
    Does any1 know how to get that.
    Or at least how to get AD schema using C#.

    Any help/links wud be appreciated.

    thanks,
    shashank kadge

  • Willy Denoyette [MVP]

    #2
    Re: How to get attribute type from Active Directory

    "shashank kadge" <mailtoshanky@g mail.comwrote in message
    news:1175096484 .125241.271110@ b75g2000hsg.goo glegroups.com.. .
    hello experts,
    I want to get attribute type (whether single value or multivalue) from
    AD forest/domain.
    Does any1 know how to get that.
    Or at least how to get AD schema using C#.
    >
    Any help/links wud be appreciated.
    >
    thanks,
    shashank kadge
    >

    Search MSDN for System.Director yServices.Activ eDirectory and ADSI.
    Following is a small snip to illustrate the process...
    ....
    // property to look at
    string cn = "cn";
    // bind to the directory server (bind to the DC) with appropriate credentials.
    DirectoryContex t dc = new DirectoryContex t(DirectoryCont extType.Directo ryServer,
    "somedomainsDC" , "domaindmin ", "hisPwd");
    // Get the schema from the context you are binding with.
    ActiveDirectory Schema schema = ActiveDirectory Schema.GetSchem a(dc);
    // find the property (attribute in LDAP parlance).
    ActiveDirectory SchemaProperty prop = schema.FindProp erty(cn);
    // show some of it's properties
    Console.WriteLi ne("{0} - {1} - {2}", prop.Name, prop.Syntax, prop.IsSingleVa lued);

    Willy.

    Comment

    Working...