PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Redemption accessing address book

Reply

Redemption accessing address book

 
Thread Tools Rate Thread
Old 13-02-2004, 03:59 PM   #1
George Sambataro
Guest
 
Posts: n/a
Default Redemption accessing address book


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







  Reply With Quote
Old 13-02-2004, 08:38 PM   #2
Dmitry Streblechenko \(MVP\)
Guest
 
Posts: n/a
Default Re: Redemption accessing address book

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


"George Sambataro" <george_nospam@pcwp.com> wrote in message
news:u86dncFeYKDQabHdRVn-uQ@comcast.com...
> 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
>
>
>
>
>
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off