I need create a view that will return active directory information as a view; specifically ; I need the login name and full name of the user. I have successfully done this once in ASP; but need to have it as a view on SQL server for another application; I have already linked the ADSI server but all attempts at creating a view like this apparently run up against the brick wall of logging in as my low security user.
Attached is how i did it in ASP:
strUser = "SCAP\phonebook"
strPassword = "phonebook"
' Dim Conn, strRS, RS, strConn
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")
Conn.Provider = "ADsDSOObject"
Conn.Properties("User ID") = strUser
Conn.Properties("Password") = strPassword
Conn.Properties("Encrypt Password") = True
strConn = "Active Directory Provider"
Conn.Open strConn , strUser, strPassword
strRS = "SELECT displayname,sn,givenname,telephoneNumber,objectCategory,department FROM 'LDAP://SCAP' WHERE "
strRS = strRS & "objectCategory = 'CN=Person,CN=Schema,CN=Configuration,DC=assessor,DC=shelby,DC=tn,DC=us'"
strRS = strRS & " and ( telephoneNumber = '5*' "
strRS = strRS & " or telephoneNumber = '3*' ) order by sn"
RS.Open strRS, Conn