i folks, here is how you can pull any data points from Active Directory. in my code i get the user's email
SELECT mail FROM 'LDAP://DC=Domain,DC=win,DC=ml,dc=COM' WHERE samaccountname = 'userName'
System.Data.OleDb.OleDbConnection con;
System.Data.OleDb.OleDbDataAdapter da;
System.Data.OleDb.OleDbCommand cmd;
System.Data.DataTable dt = new System.Data.DataTable();
con = new System.Data.OleDb.OleDbConnection("Provider=ADsDSOObject;dsn=Active Directory Provider");
con.Open();
// Create a command object on this connection
cmd = new System.Data.OleDb.OleDbCommand(this.tbQuery.Text, con);
da = new System.Data.OleDb.OleDbDataAdapter();
da.SelectCommand = cmd;
try
{
da.Fill(dt);
this.dgResults.DataSource = dt;
}
catch (System.Data.OleDb.OleDbException exc)
{
MessageBox.Show(exc.Message);
}
con.Close();