Problem with ldap query

Author Message
buki79

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 10/17/2005
  • Status: offline
Problem with ldap query Monday, October 17, 2005 9:32 PM (permalink)
0
Hi,
 
within an asp page I need to retrieve user information like name and email address. I can do a ldap query to get the full ldap path, but when I try to create an object with that I receive a 80072020 error.
Here's the code I used:
 <%@ Language=VBScript %>
 <%
 Response.Buffer=true
 strUser=Right(Request.ServerVariables("LOGON_USER"),8)
 Set ADOconn = CreateObject("ADODB.Connection")
 Set ADOcom = CreateObject("ADODB.Command")
 ADOconn.Provider = "ADsDSOObject"
 ADOconn.Open "ADs Provider", "xxx\id", "password"
 Set ADOcom.ActiveConnection = ADOconn
 ADOcom.Properties("Page Size") = 1000
 ADOcom.CommandText = "SELECT * from 'LDAP://xxx/dc=w1,dc=yyy,dc=net'  where SamAccountName='" & strUser & "'"
 Set Rec = ADOcom.Execute
 set fields = rec.fields(0)
 For Each objField in rec.Fields 'works fine
   ldap = objField
   response.write "result: " &objField &"<br>"
 Next
  
 Set ou=GetObject(ldap) ' here occurs the error
 For Each obj In ou
   response.write obj.Name  & obj.FullName & "<br>"
 Next
  
 %>
 

I'm quite new to vbscript and up to now I'm still confused what to use for which purpose.
It's an urgent case and I'm really stuck with that. Any help would be appreciated.
Thanks in advance.
 
Regards,
 
Andi
 
 
 
#1
    corbett

    • Total Posts : 1
    • Scores: 0
    • Reward points : 0
    • Joined: 6/30/2004
    • Location: USA
    • Status: offline
    RE: Problem with ldap query Thursday, December 22, 2005 9:37 AM (permalink)
    0
    I'm sorry that no one answered you. I was hoping to read the solution, too, because I'm in a similar situation. However, I may have an answer for you if you are not trying to run in a very specific web environment. Send me an email and I'll respond with some sample code.
     
    #2
      des

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 4/17/2008
      • Status: offline
      RE: Problem with ldap query Thursday, April 17, 2008 11:31 AM (permalink)
      0
      When I try this code, I get Table does not exist.  Any help?
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9