Solved

Get data from ActiveDirectory with C#...

Posted on 2007-03-17
2
1,597 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
2 Comments
 
LVL 15

Accepted Solution

by:
stanscott2 earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Loop not working 29 48
Programmatically signing Word macros 4 61
What is Thread.Sleep? 5 46
Wav problem 4 19
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

861 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now