A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - General Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Apply Contact's Photo via VBA or DotNet?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 16th 06, 12:21 PM posted to microsoft.public.outlook,microsoft.public.office.developer.outlook.vba
Programatix
external usenet poster
 
Posts: 4
Default Apply Contact's Photo via VBA or DotNet?

Hi,

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

Thank you.


Ads
  #2  
Old August 16th 06, 02:45 PM posted to microsoft.public.outlook,microsoft.public.office.developer.outlook.vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Apply Contact's Photo via VBA or DotNet?

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....program_v ba

--
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" wrote in message ...
Hi,

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

Thank you.


  #3  
Old August 23rd 06, 03:05 AM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.outlook
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Apply Contact's Photo via VBA or DotNet?

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" wrote in message ...
Hi,

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

Thank you.



  #4  
Old August 26th 06, 09:04 PM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.outlook
Programatix
external usenet poster
 
Posts: 4
Default Apply Contact's Photo via VBA or DotNet?

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).Ite ms

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]" wrote in message
...
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" wrote in message
...
Hi,

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

Thank you.





 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
envoi de photo christine lucy Outlook Express 34 November 11th 06 03:33 AM
how do I apply a form to one Contact? don Outlook - Using Forms 1 July 5th 06 07:40 PM
Paste a photo JOHN SMITH Outlook Express 0 June 5th 06 09:02 PM
Paste a photo MarkC Outlook Express 4 May 15th 06 09:42 AM
how to apply vba code to OL2003 forms ? TimR Outlook - Using Contacts 1 February 17th 06 05:41 PM


All times are GMT +1. The time now is 11:38 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.