Extending Schema with .NET DirectoryServices

Extending Schema with .NET DirectoryServices

Post by Paul » Thu, 03 Jul 2003 05:16:26



2 questions (see below):

I need to create new ADAM attributes and classes.
Actually, I'm doing this to programmatically load a new
schema into a new and empty ADAM instance.

I'm doing this as an alternative to the LDIFDE tool. I
feel that it will be easier to maintain an XML
representation of the schema and this code that it would
be to maintain a large LDIF file.

I can see how to use the ADSI interfaces to do this, and
I know about DirectoryEntry.NativeObject.

(1) Am I correct in assuming that DirectoryServices has
NOT exposed the interfaces necessary to extend a schema
as I've described above?

(2) Can DirectoryEntry.NativeObject be in fact cast as
IADsProperty, IADsClass, or IADsSyntax?

Thanks much,
Paul

 
 
 

Extending Schema with .NET DirectoryServices

Post by MVP - ADS » Thu, 03 Jul 2003 07:24:12


You can definitely modify schema with S.DS and it can be done without using
any of the interop stuff from the NativeObject property or by invoking
methods on other ADSI interfaces.

Here is a thread from Google that kind of shows how Jamie Vachon figured
this out earlier this year (for attributes at least):

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=O...

The basic concept is that you are essentially just using the IADs interface
to do the schema extensions.  That said, if you bind to an object in the
directory that is a classSchema or attributeSchema, you should be able to
cast it to one of the ADSI schema interfaces (assuming you have imported the
activeds.dll library).

Hopefully that will give you what you need to get going.

Joe K.


Quote:> 2 questions (see below):

> I need to create new ADAM attributes and classes.
> Actually, I'm doing this to programmatically load a new
> schema into a new and empty ADAM instance.

> I'm doing this as an alternative to the LDIFDE tool. I
> feel that it will be easier to maintain an XML
> representation of the schema and this code that it would
> be to maintain a large LDIF file.

> I can see how to use the ADSI interfaces to do this, and
> I know about DirectoryEntry.NativeObject.

> (1) Am I correct in assuming that DirectoryServices has
> NOT exposed the interfaces necessary to extend a schema
> as I've described above?

> (2) Can DirectoryEntry.NativeObject be in fact cast as
> IADsProperty, IADsClass, or IADsSyntax?

> Thanks much,
> Paul


 
 
 

1. DirectoryServices (.NET) and Exchange 5.5 on NT4

I'm having a bit of a problem accessing Exchange 5.5 LDAP through .NET on
NT4. My guess is there is some dependancy missing for the framework.

I am using NT4 sp6a, .Net Framework SP2

The below code works on Windows 2000 (where ServerName is NT or 2000) but
returns Unknown Error when running on NT (the return is instant and
regardless of the connection string).

Any pointers are greatly appreciated.

        Dim adSearcher As New DirectoryServices.DirectorySearcher()
        Dim adDirEntry As New DirectoryServices.DirectoryEntry()
        Dim adSearchResults As DirectoryServices.SearchResultCollection
        Dim adResult As DirectoryServices.SearchResult

        adDirEntry.Path = TextBox1.Text
'(LDAP://ServerName:7000/ou=xxx,o=xxx)
        adDirEntry.AuthenticationType =
DirectoryServices.AuthenticationTypes.Secure
        adSearcher.SearchRoot = adDirEntry
        ListBox1.Items.Clear()
        adSearcher.PageSize = 25
        Try

            adSearchResults = adSearcher.FindAll() '''''''''This is the line
that erorrs
            For Each adResult In adSearchResults
                Try
                    ListBox1.Items.Add(adResult.Properties("CN")(0))
                Catch
                    'MsgBox(Err.Description)

                End Try
            Next
        Catch
            MsgBox(Err.Source + ": " + Err.Number.ToString + " -- " +
Err.Description)
        End Try

2. CDrom on a4000, idefix

3. Can't .NET do ADSI/LDAP/WinNT with DirectoryServices?

4. Security and ports

5. Using .NET DirectoryServices to access an AD Attribute

6. HALO

7. Impersonation and DirectoryServices ops in .NET

8. MIDI file on Siemens S35i

9. .NET doesn't recognize DirectoryServices namespace

10. Uploading and retrieving picture from AD using C#, ASP .NET and System.DirectoryServices

11. ADSI DirectoryServices .NET beta 2 / C# Windows 2000 Server- Pro

12. C# + ADSI - DirectoryServices.dll + Window200 + .Net +

13. ADSI + ASP.NET (.NET Framework) System.Directoryservices