How to programmatically get a contact picture in Outlook 2010?

How can you get a contact image from Outlook and save it in a file?

Thanks!

+8
c # outlook outlook-2010 outlook-addin
source share
3 answers

This is also a good example of how to do this: http://www.scip.be/index.php?Page=ArticlesNET07

+3
source share
+2
source share

The other answers here are good, but there is an alternative:

Attachment.GetTemporaryFilePath Method (Outlook)

Attachment.SaveAsFile Method (Outlook)

To get the way.

var attachment = contact.Attachments["ContactPicture.jpg"] as Attachment; var path = attachment.GetTemporaryFilePath(); 

To save the file.

 var attachment = contact.Attachments["ContactPicture.jpg"] as Attachment; var path = attachment.SaveAsFile(savePath); 
0
source share

All Articles