Hey all ... can't seem to pull a few attributes from AD ... this query works :  

... but as soon as I change the attributes and add any one of these: "description", "office", or "phone", it errors out :

When those attributes are added, it dies at this line :
    Set objRecordSet = objCommand.Execute

What gives ? How do I pull a users description, office, or phone from LDAP ?  
Any good web links to pulling user info from AD using LDAP & ASP ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What error does it give you?

GitchoAuthor Commented:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
LDAP.asp, line 134


strAttributes = "sn,description,givenName,sAMAccountName,department,ADsPath"
arrAttributes = split(strAttributes,",")
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
objCommand.Properties("Sort On") = "displayName"    
Set objRecordSet = objCommand.Execute
If objRecordSet.EOF Then
      'return empty if result set empty
      XMLUserData = "<?xml version='1.0' encoding='ISO-8859-1'?><root></root>"
      Exit Function
End If
XMLtext = "<?xml version='1.0' encoding='ISO-8859-1'?>" & vbNewLine
XMLtext = XMLtext & "<xml>" & vbNewLine
' Loop through results
Do Until objRecordSet.EOF
      XMLtext = XMLtext & "<user>" & vbNewLine
      For i=0 to Ubound(arrAttributes)
            XMLtext = XMLtext & "<" & arrAttributes(i) & ">" & objRecordSet.Fields(arrAttributes(i)) & "</" & arrAttributes(i) & ">" & vbNewline
      XMLtext = XMLtext & "</user>" & vbNewLine
XMLtext = XMLtext & "</xml>"
OK another question.  Which line is 134?

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

GitchoAuthor Commented:
oh ... sorry ...

XMLtext = XMLtext & "<" & arrAttributes(i) & ">" & objRecordSet.Fields(arrAttributes(i)) & "</" & arrAttributes(i) & ">" & vbNewline

It seems that the query executes just fine (there's no error at the "Set objRecordSet = objCommand.Execute" line), but I can't refer to the property in the variable.
GitchoAuthor Commented:
i figured it out ... "description", "office", and "phone" are multi-valued items (arrays), and can't be referred to directly.
Closed, 500 points refunded.

Community Support Moderator
Experts Exchange

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.