Redemption accessing address book

  • Thread starter Thread starter George Sambataro
  • Start date Start date
G

George Sambataro

Dmitry.. I sent this directly to you also but thought somone else might have
the answer and it is likely also of interest to the group.

I need to READ (only) the Outlook address book (contacts and distribution
list) . without having to deal with the security message.
The following (CDO) code is able to read the outlook addressbook and the
contents of the distribution lists. How does this code need to change when
using the Outlook Redemption DLL?

Thanks,

George


**********************************


' code to attach to outlook session and pull down address book
' need to program in Redemption

Dim objSession As MAPI.Session

Dim objAddrList As MAPI.AddressList

Dim objAddrEntries As MAPI.AddressEntries

Dim objAddrEntry As MAPI.AddressEntry

Dim objDistMembers As MAPI.AddressEntries

Dim objDistMember As MAPI.AddressEntry

Set objSession = CreateObject("MAPI.Session")

objSession.Logon ("Outlook")

'Get the PAB

Set objAddrList = objSession.GetAddressList(CdoAddressListPAB)

'Move through the users and distribution lists in the PAB

Set objAddrEntries = objAddrList.AddressEntries

Set objAddrEntry = objAddrEntries.GetFirst

Do Until objAddrEntry Is Nothing

With objAddrEntry

Select Case .DisplayType

Case CdoUser, CdoRemoteUser

'Entry is a user

Debug.Print "Address book Name and email address: " & .Name
& ", " & .Address

Case CdoPrivateDistList

'Move through the distribution list members

Set objDistMembers = .Members

Set objDistMember = objDistMembers.GetFirst

Debug.Print "Distribution list name: " & objAddrEntry.Name

Do Until objDistMember Is Nothing '

Debug.Print " Distribution list member Name and email
address: " & objDistMember.Name & ", " & objDistMember.Address

Set objDistMember = objDistMembers.GetNext

Loop

End Select

End With

Set objAddrEntry = objAddrEntries.GetNext

Loop

Set objDistMember = Nothing

Set objDistMembers = Nothing

Set objAddrEntries = Nothing

Set objAddrEntry = Nothing

Set objAddrList = Nothing

Set objSession = Nothing
 
You need to create an instance of the Redemption.AddressLists object and go
from there - it is very similar to Namespace.AddressLists in OOM.

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