Using COM Interop to Access ADSI
System.DirectoryServices redefines selected, commonly used data structures and constants that are provided in ADSI. However, during the transition between COM applications and managed code applications, there will be situations in which you will want a managed code application to have access to the features that are provided by low-level ADSI structures or advanced interfaces.
To provide this interoperability between the underlying ADSI and managed code, the common language runtime has provided COM interop, which you can use to access any ADSI feature. This topic describes how to use COM interop to access ADSI.
Setting up COM Interop in Your Application
Open Visual Studio and create a new project.
From Project, click Add References... to open the Add Reference dialog.
Click the COM tab.
Select Active DS Type Library from the list in the Add Reference dialog box.
Click OK to add the ADSI library.
Instead of a reference you can add a using statement to your application, as shown in the following code example.
using ActiveDs;
Imports ActiveDs
If you do not add a reference or a using statement, you must add the fully-qualified name for the ADSI library as shown in the following code example.
ActiveDs.IADsSecurityDescriptor
See Also
Reference
Concepts
Send comments about this topic to Microsoft.
Copyright © 2007 by Microsoft Corporation. All rights reserved.