Click here to Skip to main content
6,594,932 members and growing! (15,965 online)
Email Password   helpLost your password?
General Reading » Hardware & System » General     Beginner

Simple Active Directory Browser Dialog

By thund3rstruck

Folder/File-like Browser Dialog for Active Directory Objects
C# 2.0, Windows, .NET 2.0VS2005, Dev
Posted:25 Mar 2007
Views:21,402
Bookmarked:29 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
12 votes for this article.
Popularity: 4.05 Rating: 3.75 out of 5
1 vote, 8.3%
1
1 vote, 8.3%
2

3
5 votes, 41.7%
4
5 votes, 41.7%
5

Screenshot - DirectoryServicesBrowser.jpg

Introduction

Attached is an extremely simple DirectoryServicesBrowserDialog Form that can be added to any Active Directory application. It acts similar to a FileOpenDialog or FolderOpenDialog class. In addition to providing an interface for browsing for Active Directory objects, it also sets some properties that can be called after selecting an object such as the object's fully qualified path, the objectGUID, and the common name of the object.

Background

This Form uses a few of the methods from a previous article of mine: Howto: (Almost) Everything In Active Directory via C#. Of course, if I were to use this dialog in production I would extend it to do a lot more, but this should serve as a clean demonstration of how to use some of the methods presented in that article.

Using the code

There's nothing to it. Just instantiate the object and send in credentials (if necessary). When the application calls the _Load event the browser will enumerate the forest for the domains attached. To keep the application snappy, you must select a node to be able to expand it to see the object's children.

Opening the Dialog with the credentials of the Logged in User

DirectoryServicesBrowserDialog DirectoryBrowser =
      new DirectoryServicesBrowserDialog(null, null);
DirectoryBrowser.ShowDialog();

Opening the Dialog with the credentials of a service account

DirectoryServicesBrowserDialog DirectoryBrowser =
        new DirectoryServicesBrowserDialog
        ("ServiceUserName", "ServiceUserPassword");
DirectoryBrowser.ShowDialog();

History

  • Originally submitted on 25 March 2007

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

thund3rstruck


Member
I'm a typical 30 year old generation X guy that likes video games, NFL football, and comic style art. I have an insatiable passion for programming and doing what ever it takes to become a better programmer.
Occupation: Software Developer
Location: United States United States

Other popular Hardware & System articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 2 of 2 (Total in Forum: 2) (Refresh)FirstPrevNext
GeneralBrilliant Pinmemberchrishulbert19:17 10 Mar '09  
GeneralI gotta tell ya... PinsitebuilderShog917:01 25 Mar '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 25 Mar 2007
Editor: Deeksha Shenoy
Copyright 2007 by thund3rstruck
Everything else Copyright © CodeProject, 1999-2009
Web20 | Advertise on the Code Project