Click here to Skip to main content
13,191,642 members (70,780 online)
Click here to Skip to main content
Add your own
alternative version


43 bookmarked
Posted 3 Nov 2003

Simple Active Directory Browser

, 16 Dec 2003
Rate this:
Please Sign up or sign in to vote.
A simple Active Directory Browser for beginners.

Sample Image - ActiveDirectoryBrowser.jpg


Ever wondered how to write a simple Active Directory Browser? Well, then look at my example code here. Its quite simple and straightforward. I am utilizing System.DirectoryServices to connect to AD and enumerate objects.

Of course, this is a simple example which doesn't include threading to make the user interface respond faster. But it will give you an idea of how to connect to AD and do some simple browsing.

I also used my listview column sorter class, which is available here.

Code Basics

To connect to Active Directory is quite simple:

// connect to active directory 
DirectoryEntry rootDSE = new 
  DirectoryEntry("LDAP<A href="ldap://rootDSE/">://rootDSE/</A>"); 
DirectoryEntry root = new DirectoryEntry("LDAP://" + 

The property defaultNamingContext contains the domain name in format: "dc=test,dc=com" (for domain name "") which we use to connect to the domain.


  • 2003-11-04 - First edition, more updates will come later.
  • 2003-11-13 - Dominic found a bug. I uploaded a new example project that fixes the bug.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Sven So.
Software Developer (Senior) biggest furniture dealer in the world
Germany Germany
No Biography provided

You may also be interested in...

Comments and Discussions

Questionrefresh button Pin
abu sabha19-May-15 23:36
memberabu sabha19-May-15 23:36 
AnswerRe: refresh button Pin
Sven So.20-Jul-15 22:06
memberSven So.20-Jul-15 22:06 
QuestionLicense Terms Pin
Manual178921-Dec-12 3:14
memberManual178921-Dec-12 3:14 
AnswerRe: License Terms Pin
Sven So.2-Jan-13 23:20
memberSven So.2-Jan-13 23:20 
QuestionHaving trouble figuring out images Pin
David Bayer23-Sep-09 3:10
memberDavid Bayer23-Sep-09 3:10 
AnswerRe: Having trouble figuring out images Pin
Sven So.23-Sep-09 4:42
memberSven So.23-Sep-09 4:42 
GeneralRe: Having trouble figuring out images Pin
David Bayer23-Sep-09 5:16
memberDavid Bayer23-Sep-09 5:16 
GeneralRe: Having trouble figuring out images Pin
David Bayer23-Sep-09 5:30
memberDavid Bayer23-Sep-09 5:30 
GeneralRe: Having trouble figuring out images Pin
Sven So.23-Sep-09 22:26
memberSven So.23-Sep-09 22:26 
GeneralDisplay Properties Pin
R.Palanivel3-Jun-09 0:03
memberR.Palanivel3-Jun-09 0:03 
QuestionRe: Display Properties Pin
Sven So.5-Jun-09 3:58
memberSven So.5-Jun-09 3:58 
AnswerRe: Display Properties Pin
R.Palanivel7-Jun-09 0:53
memberR.Palanivel7-Jun-09 0:53 
GeneralGood GUI Pin
Zhefu Zhang2-Jan-04 14:27
memberZhefu Zhang2-Jan-04 14:27 
GeneralBitmaps Pin
Bruce Cutler16-Dec-03 11:35
sussBruce Cutler16-Dec-03 11:35 
GeneralRe: Bitmaps Pin
stotti_no116-Dec-03 19:39
memberstotti_no116-Dec-03 19:39 
GeneralRe: Bitmaps Pin
SaurweinAndreas17-Dec-03 2:59
memberSaurweinAndreas17-Dec-03 2:59 
GeneralRe: Bitmaps Pin
stotti_no14-Jan-04 21:27
memberstotti_no14-Jan-04 21:27 
GeneralDomains Pin
sevenstorydrop15-Nov-03 9:56
membersevenstorydrop15-Nov-03 9:56 
GeneralRe: Domains Pin
scatter15-Nov-03 10:09
memberscatter15-Nov-03 10:09 
GeneralRe: Domains Pin
sevenstorydrop16-Nov-03 13:36
membersevenstorydrop16-Nov-03 13:36 
GeneralRe: Domains Pin
stotti_no117-Nov-03 19:40
memberstotti_no117-Nov-03 19:40 
GeneralRe: Domains Pin
Daniel Romano10-Mar-05 10:40
sussDaniel Romano10-Mar-05 10:40 
GeneralSorting columns error Pin
jsk647814-Nov-03 3:40
sussjsk647814-Nov-03 3:40 
GeneralRe: Sorting columns error Pin
stotti_no117-Nov-03 19:38
memberstotti_no117-Nov-03 19:38 
GeneralRe: Sorting columns error Pin
jsk647818-Dec-03 5:38
sussjsk647818-Dec-03 5:38 
GeneralCan't get it to work Pin
Domenic12-Nov-03 7:09
memberDomenic12-Nov-03 7:09 
GeneralRe: Can't get it to work Pin
stotti_no112-Nov-03 20:50
memberstotti_no112-Nov-03 20:50 
GeneralRe: Can't get it to work Pin
Domenic13-Nov-03 2:23
memberDomenic13-Nov-03 2:23 
GeneralRe: Can't get it to work Pin
stotti_no113-Nov-03 2:35
memberstotti_no113-Nov-03 2:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171017.2 | Last Updated 17 Dec 2003
Article Copyright 2003 by Sven So.
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid