Solved

Get data from ActiveDirectory with C#...

Posted on 2007-03-17
2
1,600 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I hide MVVM menu items in WPF/XAML? 1 54
Trying to understand what this mean...types(lstTypes[i].AvailableDatatype) 2 37
Coding for the first time 9 99
What!!!??? 5 60
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…

739 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