Outlook Redemption expand distribution list

K

Kalyan

I need to expand the distribution list(DL).. both DL in Exchange and
private contacts. I somewhat tried two ways of doing it but not successful
in either
method.

I've Redemption installed with Outlook 2007.

Method 1: Using Redemption.RDOSession
I tried out the following code
using RDO. I knew there is strightforward API to achieve but in the
following code snippet, after the 6th line
"set Sesn = CreateObject("Redemption.RDOSession")"
, it doesn't work or throw any error message.

What else is required in addition to installing Redemption? Yours assistence
is much appreciated.

function TestRedemtionDL
MsgBox "in TestRedemtionDL"
set outlookObj=CreateObject("Outlook.Application")
set sessionObj = outlookObj.GetNameSpace("MAPI")
MsgBox "in TestRedemtionDL after app"
set Sesn = CreateObject("Redemption.RDOSession")
if Err.number <> 0 or Sesn = nothing then
MsgBox "in TestRedemtionDL after RDOSession"
end if
'Sesn.Logon
Sesn.MAPIOBJECT = sessionObj.MAPIOBJECT
MsgBox " Sesn.CurrentUser.Name " & Sesn.CurrentUser.Name
MsgBox "logging in"
set AB = Sesn.AddressBook
MsgBox "After AB "
set Recips = AB.ShowAddressBook
MsgBox Recips.Count
MsgBox "Err " & Err.Description
end function


Method 2 : Using Redemption.MAPIUtils. Partially working but not does what
exactly required.

I'm trying an VBS code to enumerate/expand the distribution list(DL) and get
the members of DL. Following code snippet is not working, member count is 0.
Could anybody please help on this. Your help is much appreciated. I did
exhaustive googling on it.

..........
set utilobj = CreateObject("Redemption.MAPIUtils")

set colCDORecips = utilobj.AddressBook(Nothing,"Select Recipient",False,
True, 1,"To")
Count = colCDORecips.Count

For i = 1 To Count
'MsgBox "redemtion " & Count
Set recipientObj = colCDORecips.Item(i)
MsgBox "recipientObj.AddressEntry.Type " &
recipientObj.AddressEntry.Type
MsgBox "recipientObj.AddressEntry.DisplayType " &
recipientObj.AddressEntry.DisplayType
MsgBox "recipientObj " & recipientObj.DisplayType
displayName=recipientObj.Name
contactType= recipientObj.AddressEntry.Type
if contactType = "EX" then
if recipientObj.AddressEntry.DisplayType = 1 then
'set Citems = recipientObj.GetMember(1)
'email=oEDL.PrimarySmtpAddress
'set SafeDist = CreateObject("Redemption.SafeDistList")
Set oDL = recipientObj
' I tried all the objects related to Recipient object in Outlook API
Call ShowGALInfoFromDL(recipientObj) 'Code for the sub is
below
'SafeDist.Item=recipientObj
'SafeContact.Item=recipientObj.AddressEntries
else
email=recipientObj.AddressEntry.Fields(&H39FE001F)
addEmailItems displayName, email, mode
end if
elseif contactType = "SMTP" then
email=recipientObj.Address
addEmailItems displayName, email, mode ......
.......

Sub ShowGALInfoFromDL(dl)
MsgBox "In ShowGALInfoFromDL"
' constants for MAPI property tags
Const PR_ACCOUNT = &H3A00001E ' alias
Const PR_GIVEN_NAME = &H3A06001E ' given name
Const PR_SURNAME = &H3A11001E ' surname
Const PR_TITLE = &H3A17001E ' title
Const PR_DISPLAY_NAME = &H3001001E ' display name

Set rdl = CreateObject("Redemption.SafeDistList")
rdl.Item = dl
count = rdl.MemberCount
MsgBox "count " & count
For i = 1 To count
Set rrecip = rdl.GetMember(i)
' is it an individual contact (not a DL)?
If rrecip.DisplayType = olUser Then
' is it an Exchange user?
Set rae = rrecip.AddressEntry
If rae.Type = "EX" Then
alias = rae.Fields(PR_ACCOUNT)
display = rae.Fields(PR_DISPLAY_NAME)
first = rae.Fields(PR_GIVEN_NAME)
last = rae.Fields(PR_SURNAME)
title = rae.Fields(PR_TITLE)
MsgBox "display " & display
End If
End If
Next

Set rae = Nothing
Set rdl = Nothing
Set rrecip = Nothing
End Sub

Your help is much appreciated. Thank u in advance.

-Kalyan
 

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