Click here to Skip to main content
13,287,856 members (42,876 online)
Click here to Skip to main content
Add your own
alternative version


18 bookmarked
Posted 1 Apr 2004

An easy to use class to list Active Directory Users

, 1 Apr 2004
Rate this:
Please Sign up or sign in to vote.
A very simple class which can list all the Active Directory users just by calling a single member function.

Sample Image - ADUsers.jpg


The purpose of this very brief text is to present a simple class CActiveDirectoryUser. This is a very easy to use C++ class in which you can simply list all the users in the ActiveDirectory by just a single function call. The code inside the class is very simple. It actually wraps some ADSI calls and can be easily understood.


CActiveDirectoryUsers ADUsers;
CStringArray Array;
bool res=ADUsers.GetADUsers(Array);
for(int i=0;i<Array.GetCount();i++)
 CString strUser=Array.GetAt(i);
 //Do whatever

The function GetADUsers() returns false in case of failure and returns true in case of success, so the CStringArray contents will be only valid if the return value is true.


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

Muhammad Ahmed
Software Developer (Senior) ITRS Group plc, London, UK
Pakistan Pakistan
I have done masters in networks and e-business centred computing from The University of Reading, UK, Carlos III de Madrid, Spain and Aristotle University of Thessaloniki. Presently working in a London based software company as a senior software engineer. I like programming in C++, Java and C#, besides software development I spend my spare time in photography and music.

find me on facebook here!/profile.php?id=764610012

You may also be interested in...


Comments and Discussions

Generalget error in pobject-&gt;get Pin
Member 38512868-Jul-09 23:29
memberMember 38512868-Jul-09 23:29 
GeneralUsers of a Active Directory group Pin
Wittejoen19-Jun-08 4:45
memberWittejoen19-Jun-08 4:45 
GeneralGet User login names Pin
vikrams11-Jun-06 21:40
membervikrams11-Jun-06 21:40 
Is there any way to get users login names from active directory?
GeneralMissing sddl.h Pin
Larsson7-Mar-05 23:14
memberLarsson7-Mar-05 23:14 
GeneralMemory leaks Pin
blippblapp2-Oct-04 3:04
memberblippblapp2-Oct-04 3:04 
QuestionVBS samples ?? Pin
benfr117-Jun-04 2:22
memberbenfr117-Jun-04 2:22 

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
Web04 | 2.8.171207.1 | Last Updated 2 Apr 2004
Article Copyright 2004 by Muhammad Ahmed
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid