Reputation: 7622
How can you get a contact's picture from Outlook and save it to a file?
Thanks!
Upvotes: 9
Views: 6429
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
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