[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

Adding New Schema to Active Directory

Robert L

9/30/2002 2:07:00 AM

Does anybody have a good reference or example on how to create and add new
schemas to the Active Directory?

Thanks


1 Answer

Ronny Ong

9/30/2002 4:15:00 PM

0

"Robert Lario" <lario@*SPAM*DiemSolutions.com> wrote in message
news:OaO7j2BaCHA.1292@tkmsftngp12...
> Does anybody have a good reference or example on how to create and add new
> schemas to the Active Directory?

Extending the schema of AD is a serious thing. It's not just a matter of
writing the code. You need to do some serious thinking about deployment and
administration issues ranging from security to disaster recovery. I
recommend starting with Chapter 9 of the book
http://www.microsoft.com/mspress/book.... It's not a .NET book so the
code samples are in C++ but it covers the important concepts.

As far as .NET code, here's an old newsgroup posting with a C# sample...

>From: a-davst@online.microsoft.com (David Stucki [MS])
>Organization: Microsoft
>Date: Fri, 03 May 2002 21:35:53 GMT
>Subject: RE: Extending Active Directory Schema
>X-Tomcat-NG: microsoft.public.dotnet.framework.interop
>Message-ID: <L0prFqu8BHA.1696@cpmsftngxa07>
>Newsgroups: microsoft.public.dotnet.framework.interop
>
>Before you extend the schema you should read pretty much everything in this
>MSDN topic and below.
>
>How to Extend the Schema:
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/...
h
>ow_to_extend_the_schema.asp
>
>Here's some C# code on how to add an attribute to the AD. Similar syntax
>can be used to add a class.
>
>//***Creating an Attribute***
>DirectoryEntry rootDse = new DirectoryEntry("LDAP://RootDSE");
>string schemaNC = (string)rootDse.Properties["schemaNamingContext"].Value;
>DirectoryEntry schemaEntry = new DirectoryEntry("LDAP://" + schemaNC);
>DirectoryEntry attribute = schemaEntry.Children.Add("cn=attrTest04",
>"attributeSchema");
>attribute.Properties["attributeId"].Add("1.2.840.113556.1.4.7000.233.28688.
2
>8684.8.113567.421.2001541.816060");
>attribute.Properties["oMSyntax"].Add(20);
>attribute.Properties["attributeSyntax"].Add("2.5.5.4");
>attribute.Properties["isSingleValued"].Add(true);
>attribute.Properties["lDAPDisplayName"].Add("attrTest04");
>attribute.CommitChanges();
>Console.WriteLine("done");
>
>You should be able to add a class by modifying the above code.
>
>Hope this helps,
>Dave Stucki
>Microsoft Developer Support
>
>This posting is provided "AS IS" with no warranties, and confers no rights.