Sybux
asked on
HOWTO : query LDAP with ASP (not an AD)
Hi,
I'm looking for an example of how to read value in a LDAP server. I've googled but always found example based on AD.
Does anyone got such example ?
Thx
I'm looking for an example of how to read value in a LDAP server. I've googled but always found example based on AD.
Does anyone got such example ?
Thx
ASKER
It's based on AD not ldap
AD is a directory service provider, LDAP is a protocol used to query AD and other directory service providers. The LDAP query in the article i referenced will work with AD, or any other provider - it is not an AD specific query.
ok, I think then you need to get the LDAPClient objects (http://download.cnet.com/ActiveX-LDAP-Client/3000-2206_4-10019353.html), and :
Set pLDAP = CreateObject("LDAPClient.3")
Call pLDAP.Connect("ldapserver","389","cn=Directory Manager", "password")
Set pAttributeNames = CreateObject("LDAPClient.StringCollection")
Call pAttributeNames.Add("givenName")
' Find all the Johns and all the Smiths
Set pEntries = pLDAP.Search("o=airus", "(|(givenName=John)(sn=Smith))", , pAttributeNames)
For Each pEntry In pEntries
Response.Write(pEntry.Attributes("givenName").Values(0).Value & "<br>")
Next
hope this helps
ASKER
So based on your comments, I've written this :
It seems that the query return something as "response.write (".")" print many points on screen. But I can't get any values
Set conn = Server.CreateObject("ADODB.Connection")
conn.provider ="ADsDSOObject"
conn.open "Active Directory Provider"
Set objCmd = CreateObject("ADODB.Command")
objCmd.ActiveConnection = conn
objCmd.Properties("SearchScope") = 2
objCmd.Properties("Page Size") = 20
objCmd.CommandText = "select cn,mail,sn from 'LDAP://" & ldapIp & "/" & ldapDn & "'"
response.write objCmd.commandtext & "<br>"
Set rs = objCmd.Execute
While Not rs.EOF
response.write rs.Fields("sn")
response.write (".")
rs.MoveNext
wend
It seems that the query return something as "response.write (".")" print many points on screen. But I can't get any values
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Team work to fine the tip
set objADsPath as needed
Open in new window