PC Review


Reply
Thread Tools Rate Thread

Apply Contact's Photo via VBA or DotNet?

 
 
Programatix
Guest
Posts: n/a
 
      16th Aug 2006
Hi,

Is there a way to apply a photo to a contact via VBA or DotNet?

Thank you.


 
Reply With Quote
 
 
 
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      16th Aug 2006
No.

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/comm...ok.program_vba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and 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.
>
>

 
Reply With Quote
 
=?Utf-8?B?U3VlIE1vc2hlciBbTVZQLU91dGxvb2td?=
Guest
Posts: n/a
 
      23rd Aug 2006
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.
> >
> >

>

 
Reply With Quote
 
Programatix
Guest
Posts: n/a
 
      26th Aug 2006
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.
>> >
>> >

>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apply Photo to Contact Programatix Microsoft Outlook VBA Programming 2 17th Aug 2006 03:01 PM
incompatibility with dotnet 2.0 and Outlook Business Contact Manager 2003 J Microsoft VB .NET 5 8th May 2006 04:17 AM
in Contact design view how do I create 'add contact photo'? =?Utf-8?B?VG9kZCBNZW5hcmQ=?= Microsoft Outlook Contacts 3 9th Dec 2005 11:52 PM
How do I apply photo corners to pictures? =?Utf-8?B?LUQ=?= Microsoft Powerpoint 3 29th Oct 2004 04:17 PM
Incorporating dotNet custom control in contact .oft Coen@Work Microsoft Outlook Form Programming 3 4th May 2004 01:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:45 PM.