Private Distribution Lists

S

StevePurvey

My program is a VB6 add-in for Outlook 2000,2002,2003

I am using Redemption to overcome the security issues. I need to
access the members of Private address lists within contact folders,
specifically I need to access the contact mobile telephone number.

The following code extracts some of the .member properties but not all
are available.


'The following loop gets the contacts from the DistList in the folder

ElseIf sType = "DistListItem" Then
Set myDistList = oContactFolder.Items.Item(intA)
For intB = 1 To myDistList.MemberCount
sAddress = myDistList.GetMember(intB).Address
sName = myDistList.GetMember(intB).Name
sEntry = myDistList.GetMember(intB).EntryID
Next intB
End If


My question is, is there a way of extracting the mobile telephone
number??

Many thanks

Steve P
 
D

Dmitry Streblechenko \(MVP\)

Outlook stores two kinds of entry ids in DistLists (look at the DL using
OutlookSpy) - real entry ids and one-offs (one-off entry ids embed name,
address and address type). Redemption always uses one-off entryids - this
way Redemption (and Outlook) will be able to access names and addresses even
if the original member was deleted. The list of the real entry ids is
mangled - in case of the Contacts, Outlook prefixes the entry id with
00000000C091ADD3519DCF11A4A900AA0047FAA4C3". Once you remove it, you get the
real entry id, which you can then use to open the regular ContactItem
object:

PR_CELLULAR_TELEPHONE_NUMBER = &H3A1C001E
PT_MV_BINARY = &H1102
set Utils = CreateObject("Redemption.MAPIUtils")
set sDistList = CreateObject("Redemption.SafeDistList")
sDistList.Item = DistListItem
pr_list_entryids =
sDistList.GetIDsFromNames("{00062004-0000-0000-C000-000000000046}", &H8055)
pr_list_entryids = pr_list_entryids or PT_MV_BINARY
members =sDistList.Fields(pr_list_entryids)
for i = LBound(members) to UBound(members)
entryid = Utils.HrArrayToString(members(i))
if mid(entryid, 1, 42) = "00000000C091ADD3519DCF11A4A900AA0047FAA4C3" Then
'this is a contact
entryid = Right(entryid, Len(entryid) - 42)
set oContact = Application.Session.GetItemFromID(entryid)
Mobile = oContact.MobileTelephoneNumber
Else
'this is a regular (GAL etc) address entry
set AE = Utils.GetAddressEntryFromID(entryid)
Mobile = AE.Fields(PR_CELLULAR_TELEPHONE_NUMBER)
End If
debug.print("Mobile: " & Mobile)
next

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

StevePurvey

Hi Dmitry

Does this only work for Exchange DistList or Private Dist Lists stored
in Outlook?

I get different entry IDs for the members of the dist list. The being
either "00000000C091ADD3519DCF11A4A900AA0047FAA4B6" or
"00000000C091ADD3519DCF11A4A900AA0047FAA4B5"

If I strip the first 42 characters then I am still not able to open
the contact by entry ID.

Steve P
 
D

Dmitry Streblechenko \(MVP\)

Hmmm... What is the value of the entry id returned by
Utils.HrArrayToString(members(i))?
What is the entry id of the corresponding contact (ContactItem.EntryID)?

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top