Click here to Skip to main content
Licence 
First Posted 3 Nov 2003
Views 116,125
Bookmarked 37 times

Simple Active Directory Browser

By | 16 Dec 2003 | Article
A simple Active Directory Browser for beginners.

Sample Image - ActiveDirectoryBrowser.jpg

Introduction

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://" + 
  (string)rootDSE.Properties["defaultNamingContext"].Value);

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

History

  • 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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Sven So.

Software Developer (Senior)
biggest furniture dealer in the world
Germany Germany

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionHaving trouble figuring out images PinmemberDavid Bayer3:10 23 Sep '09  
AnswerRe: Having trouble figuring out images PinmemberSven So.4:42 23 Sep '09  
GeneralRe: Having trouble figuring out images PinmemberDavid Bayer5:16 23 Sep '09  
GeneralRe: Having trouble figuring out images PinmemberDavid Bayer5:30 23 Sep '09  
GeneralRe: Having trouble figuring out images PinmemberSven So.22:26 23 Sep '09  
GeneralDisplay Properties PinmemberR.Palanivel0:03 3 Jun '09  
QuestionRe: Display Properties PinmemberSven So.3:58 5 Jun '09  
AnswerRe: Display Properties PinmemberR.Palanivel0:53 7 Jun '09  
GeneralGood GUI PinmemberZhefu Zhang14:27 2 Jan '04  
GeneralBitmaps PinsussBruce Cutler11:35 16 Dec '03  
GeneralRe: Bitmaps Pinmemberstotti_no119:39 16 Dec '03  
GeneralRe: Bitmaps PinmemberSaurweinAndreas2:59 17 Dec '03  
GeneralRe: Bitmaps Pinmemberstotti_no121:27 4 Jan '04  
GeneralDomains Pinmembersevenstorydrop9:56 15 Nov '03  
GeneralRe: Domains Pinmemberscatter10:09 15 Nov '03  
GeneralRe: Domains Pinmembersevenstorydrop13:36 16 Nov '03  
GeneralRe: Domains Pinmemberstotti_no119:40 17 Nov '03  
GeneralRe: Domains PinsussDaniel Romano10:40 10 Mar '05  
GeneralSorting columns error Pinsussjsk64783:40 14 Nov '03  
GeneralRe: Sorting columns error Pinmemberstotti_no119:38 17 Nov '03  
GeneralRe: Sorting columns error Pinsussjsk64785:38 18 Dec '03  
GeneralCan't get it to work PinmemberDomenic7:09 12 Nov '03  
GeneralRe: Can't get it to work Pinmemberstotti_no120:50 12 Nov '03  
GeneralRe: Can't get it to work PinmemberDomenic2:23 13 Nov '03  
GeneralRe: Can't get it to work Pinmemberstotti_no12:35 13 Nov '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web04 | 2.5.120517.1 | Last Updated 17 Dec 2003
Article Copyright 2003 by Sven So.
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid