Thanks. Well, I figured that out and came up with the following code below.
The image file must be named as the contact's save as name.
Public Sub UpdateContactPhoto(ContactPhotoPath As String)
Dim myOlApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myContacts As Outlook.Items
Dim myItems As Outlook.Items
Dim myItem As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myContacts = myNamespace.GetDefaultFolder(olFolderContacts).Items
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
For Each myItem In myContacts
If (myItem.Class = olContact) Then
Dim myContact As Outlook.ContactItem
Set myContact = myItem
Dim strPhoto As String
strPhoto = ContactPhotoPath & myContact.FileAs & ".jpg"
If fs.FileExists(strPhoto) Then
myContact.AddPicture strPhoto
myContact.Save
End If
End If
Next
End Sub
"Sue Mosher [MVP-Outlook]" <(E-Mail Removed)> wrote in message
news:250A10B2-1A0E-4F7F-962C-(E-Mail Removed)...
> Drat! I completely forgot about the ContactItem.AddPicture method, which
> should do just what you want.
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook Programming: Jumpstart
> for Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>>
>> "Programatix" <N$(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>> > Hi,
>> >
>> > Is there a way to apply a photo to a contact via VBA or DotNet?
>> >
>> > Thank you.
>> >
>> >
>>