ASP & LDAP Info on Users
Posted on 2007-03-27
A simple one for an expert, I'm sure. I'm tring to pull out info from my 2003 AD in to a web page via ASP to show basic contact info on users from specific groups. my ASP looks like this:
strUser = "Domain\User"
strPassword = "Password"
SDomain = "Domain"
sLogonDomain = "User or Search"
Dim Conn2, strRS2, RS2, strConn2
Set Conn2 = Server.CreateObject("ADODB.Connection")
Set RS2 = Server.CreateObject("ADODB.Recordset")
Conn2.Provider = "ADsDSOObject"
Conn2.Properties("User ID") = strUser
Conn2.Properties("Password") = strPassword
Conn2.Properties("Encrypt Password") = True
strConn2 = "Active Directory Provider"
Conn2.Open strConn2 , strUser, strPassword
strRS2 = "SELECT givenname,sn,title,telephoneNumber,mail FROM 'LDAP://" & SDomain &"' WHERE sAMAccountName = '"&sLogonDomain &"' ORDER by name "
RS2.Open strRS2, Conn2,1,1
While RS2.EOF = False
Set RS2 = Nothing
The above works really well for a single user specified in sLogonDomain, say my own account. What i need to do is pull out the info for all the users in group such as 'Marketing'. If i specify 'Marketing' in sLogonDomain the ASP doesn't report any errors but no data comes out. Can anyont point me in the right direction?