Directory Services |
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 instances when you will want a managed code application to have access to the features 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. 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
The ADSI Library Reference will appear on Visual Studio .NET Solution Explorer window. Please see figure below.
Instead of a reference you can add a using statement to your application, as shown in the following code example.
[C#]
using ActiveDs;
[Visual Basic .NET]
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