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
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