
Resolve Contact to Public Folder
I'm writing a
VBA application that adds a member to a distribution list for
a conact. Both the DL and contact are in a public folder. In Outlook 2000,
I have set the "Show this folder as an e-mail Address Book" on. When using
the resolveall method, the name is not resolved to the contact in the public
folder. If I copy the the contact to my conacts folder, resolveall works.
Should the application resolve addressess to contact in a public folder? If
so, how would I do it. Below is the code I'm using. Thanks for the help.
== Code ==
Sub UpdateDLAffilEmail()
Dim golApp As Outlook.Application
Dim gnspNameSpace As Outlook.NameSpace
Dim fldFolder As Outlook.MAPIFolder
Dim sF1, sF2, sF3, sF4 As String
Dim objItems As Outlook.Items
Dim objDL As Outlook.DistListItem
Dim objContact As Outlook.ContactItem
Dim objMailItem As Outlook.MailItem
Dim objRec As Outlook.Recipients
Dim objrec1 As Outlook.Recipient
Set golApp = New Outlook.Application
Set gnspNameSpace = golApp.GetNamespace("MAPI")
'get distination public folder object
sF1 = "Public Folders"
sF2 = "All Public Folders"
sF3 = "Distribution Lists"
sF4 = "Credit Unions"
Set fldFolder =
gnspNameSpace.Folders(sF1).Folders(sF2).Folders(sF3).Folders(sF4)
Set objItems = fldFolder.Items
Set objMailItem = golApp.CreateItem(olMailItem)
Set objDL = fldFolder.Items("Affiliate E-Mail")
Set objRec = objMailItem.Recipients
Set objContact = objItems.Find("[Customer ID] = '136'")
objRec.Add objContact.Email1DisplayName
If Not objRec.ResolveAll Then
For Each objrec1 In objRec
If Not objrec1.Resolved Then
MsgBox objrec1.Name
End If
Next
End If
objDL.AddMembers objRec
objDL.Save
End Sub