issue resolving a recipient when contact has two email addresses

  • Thread starter Thread starter Ronald van Aalten
  • Start date Start date
R

Ronald van Aalten

Hi All,

I have a very hard time trying to work with distribution lists (VB6 +
redemption). One problem I encounter is when I want Outlook to resolve
a recipient that is a contact in the default contacts folder (John
Vink) and has two email addresses ([email protected] and
(e-mail address removed)).
If I create the recipient with the code 'Recipients.Add("John Vink")'
and call Resolve then Outlook can't resolve the recipient. If I create
the recipient in this way: 'Recipients.Add("(e-mail address removed)")' then
Resolved retruns True BUT the recipient addressentry.name is still
"(e-mail address removed)", not "John Vink". When I double click this new
entry in the distribution list Oultook does NOT open the contacts
inspector but the small addressbook dialog so there seams to be no
link to the contact in the Contacts folder.

Here's the code:
===========================================
Dim oMail As Outlook.MailItem
Dim oDl As Outlook.DistListItem
Dim oRecip As Outlook.Recipient
Dim oAE As Outlook.AddressEntry

Set oDl = moNS.Folders("My
mail").Folders("Test").Items("DistListTest")
Set oMail = moOutl.CreateItem(olMailItem)
Set oRecip = oMail.Recipients.Add("(e-mail address removed)")
'Set oRecip = oMail.Recipients.Add("John Vink")
oRecip.Resolve
Debug.Print oRecip.Resolved '=> returns True
oDl.AddMember oRecip
oDl.Save
Set oAE = oRecip.AddressEntry
If Not oAE Is Nothing Then
Debug.Print oAE.Address '=> displays (e-mail address removed)
Debug.Print oAE.Name '=> displays (e-mail address removed)
Debug.Print oAE.Type '=> SMTP
End If
==============================================

I have tried several things, including using a Redemption
SafeRecipient but nothing works. I can't get the new distribution list
item to link to it's corresponding contact. Any Idea's

Ronald van Aalten
 
Try using Redemption's SafeRecipients.AddEx method. That takes both a name
and email address. Otherwise Outlook can't resolve between which recipient
email addresses you want to use for that contact. Another way that would
show a choice to the user would be to use SafeRecipient.Resolve(True), which
shows the resolution dialog if there's any ambiguity with resolving the
recipient.
 
Dear Ken,

Thanks for the tip. Unfortunately still now success. When I used
Recipients.AddEx for the first time the statement ran, Resolved returned
true BUT clicking the item in the distribution list still didn't open the
contact inspector so it WASN'T resolved after all.
When I try to run the code again Recipients.AddEx always returns this error:
error -2147418113. Could not convert variant of type (Error) into type
(Integer)

This is the code:
Dim oredRec As Redemption.SafeRecipient
Dim oredMail As Redemption.SafeMailItem
Dim oMail As Object

Set oMail = moOutl.CreateItem(olMailItem)
Set oredMail = CreateObject("Redemption.SafeMailItem")
oredMail.Item = oMail
Set oredRec = oredMail.Recipients.AddEx("John Vink",
"(e-mail address removed)")
oredRec.Resolve
Debug.Print "recip " & oredRec.Name & " in adress book?: " &
oredRec.Resolved

What can be wrong?

Ronald
 
I'm not sure.

See if things work any better if you don't use the oredRec.Resolve line.
AddEx should automatically resolve the recipient.

Are you running the latest version of Redemption? I had some similar
problems in earlier versions of Redemption and notified Dmitry and he fixed
the problem and sent me a fixed build. I'd check to see that you are using a
recent version and possibly start a new thread using your problem as the
subject (mentioning Redemption there) so Dmitry sees it and can respond. It
sounds like a problem in Redemption rather than anything else.
 
Thanks Ken,

I removed all references to previous redemption version and registered the
latest version. That solved the error. I have made a new posting because the
problem remains.

Ronald
 
Back
Top