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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
robbertConnect With a Mentor Commented:
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
 
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:
Oops,

Set objSession = CreateObject("MAPI.Session")

should be;

Set objSession = Server.CreateObject("MAPI.Session")
0
All Courses

From novice to tech pro — start learning today.