Outlook Redemption and Offline Address Book

  • Thread starter Thread starter SeeMing
  • Start date Start date
S

SeeMing

Using Redemption in VB, I would like to access Offline Address Book
(of current user session) without getting the security prompt.

Looking at the code below, obviously 'type mismatch' error is returned
when offline address book is returned. I wonder if there is a way to
set the Redemption session to current Outlook session (apart from
using MAPIOBJECT), and to retrieve the Offline address book?
Appreciate for a sample code. Many Thanks.


Dim oAddrList As Redemption.AddressList
Dim oAddrEntry As Redemption.AddressEntry

' get current namespace and session

Set m_oNS = gOLApp.GetNamespace("MAPI")
m_oNS.Logon ShowDialog:=False, NewSession:=False

Set m_oCDO = New MAPI.Session
m_oCDO.Logon ShowDialog:=False, NewSession:=False

' the following line returns type mismatch error

Set oAddrList = m_oCDO.AddressLists("Offline Address Book")
Set oAddrEntry =
oAddrList.AddressEntries(m_oNS.CurrentUser.AddressEntry.Name)

MsgBox oAddrEntry.Fields(CdoPR_ACCOUNT)
 
You don't to need to use CDO in this case: create an instance of
Redemption.AddressLists object and go from there.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top