[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 378
  • Last Modified:

Classic ASP to Query Active Directory Contacts

I have a classic ASP page that I use as a phonebook which queries against Active Directory.

I would like to add another function where it can also query Active Directory for contacts. I have over 100 fax machines that I want users to be able to look up. Our Active Directory Admin create a Contact for each one, and in the last name field called it FAX.

Here is the Query String I'm using to return users in AD and it works fine.

objCom.CommandText ="select name,telephonenumber,mobile,facsimileTelephoneNumber,pager,mail,l,physicalDeliveryOfficeName,company,title,department,sAMAccountName,sn,userAccountControl,msexchhidefromaddresslists FROM 'GC://"+objADsPath+"' where name = '*" & usrname & "*' ORDER BY name "'"
I'm assuming a new query string for Contacts should be just as simple but I can not find any reference material to know what object names to be using.
1 Solution
Shaun KlineLead Software EngineerCommented:
Scott Fell, EE MVEDeveloperCommented:
I don't have a way to test this right now but this EE question looks to be on target for what you want to do http://www.experts-exchange.com/Programming/Languages/Scripting/ASP/Q_23325902.html
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
i believe you want:

objCom.CommandText ="select fax FROM 'GC://" & objADsPath & "' where (objectCategory=computer)"

Open in new window

note I changed

+ objADsPath +


 & objADsPath &

I'm assuming you're using server side vbscript (which is the default language for classic asp). If you're using server side javascript, then continue with the format you were using

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now