PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Redemption accessing address book
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Redemption accessing address book
![]() |
Redemption accessing address book |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 > > > > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

