This topic describes how to set up a Microsoft .NET project
using System.DirectoryServices.
To use System.DirectoryServices
Start Visual Studio .NET.
Select File>New>Project.
In the Project Type column, select the project type to
create (C# or Visual Basic .NET).
In the Template column, select a project template
(Console Application, Windows Application, and so on).
Name your project.
Click OK to create your new project.
Select Project>Add Reference...
Select System.DirectoryServices.dll from the list as shown in
the following screenshot.
Click OK to add the reference.
Add the following line to your code.
C#
Using System.DirectoryServices;
VB.NET
Imports System.DirectoryServices
Note Adding the namespace using
statement to your code is unnecessary, but can simplify object
names. If you do not add this statement, then you must declare an
object as System.DirectoryServices.DirectoryEntry, instead of
DirectoryEntry.