?
Solved

Get data from ActiveDirectory with C#...

Posted on 2007-03-17
2
Medium Priority
?
1,604 Views
Last Modified: 2008-01-09
Hi,
I need to retrieve data from ActiveDirectory (AD is new for me).
There is a code which return a DataSet from the AD (which was writen by someone else).
----------------------------------------------------------------------------------------
            public static DataSet ExecuteDataset(string strSql)
            {
                  OleDbConnection con;
                  OleDbDataAdapter adapter;
                  DataSet ds = new DataSet();

                  con = new OleDbConnection("Provider=ADSDSOObject;User ID=" + PriviligeUser + ";Password=" + PriviligeUserPass + ";Encrypt Password=True;ADSI Flag=1");
                  adapter = new OleDbDataAdapter(strSql, con);
                  adapter.Fill(ds);
                  return ds;
            }
----------------------------------------------------------------------------------------
Lets say i need to get all the users that the ID Number (is there a field by that name in the AD??) is not NULL.
What is the right SQL statment that i have to pass to that function in order to get what i need??
(Is there a table? i meen - what table name do i need to write - SELECT FROM ???......)
Thanks
0
Comment
Question by:udir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
stanscott2 earned 2000 total points
ID: 18741370
Hi, this is really more than can be answered in a few questions.  Fortunately, the 15 Seconds site sets it all out very clearly here:  http://www.15seconds.com/issue/020730, "Accessing Active Directory Through the .NET Framework".

This article also includes a lot of downloadable code you can snap in -- it provides a wrapper class so that you can easily work with Active Directory user information.
0
 
LVL 1

Author Comment

by:udir
ID: 18742923
OK
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question