9

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

Thanks!

Alex
  • 7,432
  • 20
  • 75
  • 118

2 Answers2

1

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);
Frozenthia
  • 759
  • 3
  • 9
1

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

Ronan
  • 27
  • 9