Alex
Alex

Reputation: 7622

How to programmatically get a contact's picture in Outlook 2010?

How can you get a contact's picture from Outlook and save it to a file?

Thanks!

Upvotes: 9

Views: 6429

Answers (2)

Ronan
Ronan

Reputation: 27

Depending on your use case, if you are trying to grab their picture from their Outlook profile you might want to try Graph API.

Documentation here

Upvotes: 1

Frozenthia
Frozenthia

Reputation: 759

The other answers here are good, but there's also an alternative:

Attachment.GetTemporaryFilePath Method (Outlook)

Attachment.SaveAsFile Method (Outlook)

To retrieve the path.

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);

Upvotes: 1

Related Questions