Read Outlook adress-book (exchange server5.5)

Does someone have a sample script, to read out the outlook adress book??

thanks
witty
LVL 1
wittyAsked:
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.

robbertCommented:
Yes, I have.
My dumb provider does not let me upload it at the moment.
I'll try later, or write to gartenkorb@okay.net.
0
robbertCommented:
This code comes from http://support.microsoft.com/support/kb/articles/Q179/0/83.ASP, and I changed it to work with ASP.
You may use the VB code in http://support.microsoft.com/support/kb/articles/Q178/7/87.ASP, too, which contains several functions around the address book folder.
Also, I have an ASP project which adds a contact item that I may send to you.


Const strServer = "MyServer"
Const strMailbox = "MyMailbox"

strProfileInfo = strServer & vbLf & strMailbox

Set objSession = CreateObject("MAPI.Session")

objSession.Logon , , False, False, , True, strProfileInfo

Set objAddrEntries = objSession.AddressLists _
                 ("Global Address List").AddressEntries
Set objFilter = objAddrEntries.Filter
objFilter.Fields.Add CdoPR_SURNAME, "LastName"
objFilter.Fields.Add CdoPR_GIVEN_NAME, "FirstName"

On Error Resume Next

For Each objAddressEntry In objAddrEntries
      Response.Write objAddressEntry.Name
      Response.Write "E-address: " & objAddressEntry.Address
      Response.Write "Given Name: " & _
                  objAddressEntry.Fields(CdoPR_GIVEN_NAME).Value
      Response.Write "Initials: " & objAddressEntry.Fields _
                  (CdoPR_INITIALS).Value
      Response.Write "Surname: " & objAddressEntry.Fields _
                  (CdoPR_SURNAME).Value
      Response.Write "Display Name: " & objAddressEntry.Fields _
                  (CdoPR_DISPLAY_NAME).Value
      Response.Write "Alias: " & _
                  objAddressEntry.Fields(CdoPR_ACCOUNT).Value
      Response.Write "Title: " & _
                  objAddressEntry.Fields(CdoPR_TITLE).Value
      Response.Write "Company Name: " & objAddressEntry.Fields _
                  (CdoPR_COMPANY_NAME).Value
      Response.Write "Office Location: " & objAddressEntry.Fields _
                  (CdoPR_OFFICE_LOCATION).Value
      Response.Write "Office Phone 1: " &  objAddressEntry.Fields _
                  (CdoPR_OFFICE_TELEPHONE_NUMBER).Value
      Response.Write "Office Phone 2: " & objAddressEntry.Fields _
                  (CdoPR_OFFICE2_TELEPHONE_NUMBER).Value
      Response.Write "Business Fax: " & objAddressEntry.Fields _
                  (CdoPR_BUSINESS_FAX_NUMBER).Value
      Response.Write "Mobile Phone: " & objAddressEntry.Fields _
                  (CdoPR_MOBILE_TELEPHONE_NUMBER).Value
      Response.Write "Pager: " & objAddressEntry.Fields _
                  (CdoPR_PAGER_TELEPHONE_NUMBER).Value
      Response.Write "Assistant: " & objAddressEntry.Fields _
                  (CdoPR_ASSISTANT).Value
      Response.Write "Assistant Phone: " & objAddressEntry.Fields _
                  (CdoPR_ASSISTANT_TELEPHONE_NUMBER).Value
      Response.Write "Home Phone 1: " & objAddressEntry.Fields _
                  (CdoPR_HOME_TELEPHONE_NUMBER).Value
      Response.Write "Home Phone 2: " & objAddressEntry.Fields _
                  (CdoPR_HOME2_TELEPHONE_NUMBER).Value
      Response.Write "Home Fax: " & objAddressEntry.Fields _
                  (CdoPR_HOME_FAX_NUMBER).Value
      Response.Write "Home Street: " & objAddressEntry.Fields _
                  (CdoPR_HOME_ADDRESS_STREET).Value
      Response.Write "Home City: " & objAddressEntry.Fields _
                  (CdoPR_HOME_ADDRESS_CITY).Value
      Response.Write "Home State: " & objAddressEntry.Fields _
                  (CdoPR_HOME_ADDRESS_STATE_OR_PROVINCE).Value
      Response.Write "Home Postal Code: " & objAddressEntry.Fields _
                  (CdoPR_HOME_ADDRESS_POSTAL_CODE).Value
      Response.Write "Home Country: " & objAddressEntry.Fields _
                  (CdoPR_HOME_ADDRESS_COUNTRY).Value
      Response.Write "Manager Name: " & objAddressEntry.Fields _
                  (CdoPR_MANAGER_NAME).Value
      Response.Write "Manager Name: " & objAddressEntry.Manager
Next

objSession.Logoff

Set objFilter = Nothing
Set objAddrEntries = Nothing
Set objSession = Nothing
0

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
robbertCommented:
Oops,

Set objSession = CreateObject("MAPI.Session")

should be;

Set objSession = Server.CreateObject("MAPI.Session")
0
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
ASP

From novice to tech pro — start learning today.