Answered by:
Office 365 Mail REST API doesn't return ItemAttachment contents

Question
-
I've been having a lot of success using the Office 365 Mail REST API. However, when trying to retrieve email messages that are attached to other emails (i.e., Item Attachments like .msg files), the REST API does not deliver.
When I make a GET request like this for an email that has a .msg file attached to it, I get all the attachment properties *except* the "Item" property, which should contain the attachment.
GET: https://outlook.office365.com/api/v1.0/me/messages/{messageid}/attachments
RESPONSE:
{
"@odata.context": "https://outlook.office365.com/api/v1.0/$metadata#Me/{messageid}/Attachments",
"value": [
{
"@odata.type": "#Microsoft.OutlookServices.ItemAttachment",
"@odata.id": "https://outlook.office365.com/api/v1.0/Users('{useremailaddress}')/{messageid}/Attachments('{messageid}')",
"Id": "{messageid}",
"Name": "{subject}",
"ContentType": null,
"Size": 54425,
"IsInline": false,
"DateTimeLastModified": "{timestamp}"
}
]
}
My hunch is that the API won't return the Item Attachment contents because ContentType = null. However, this raises the question: why is the API unable to recognize the content type of an Item Attachment that my Outlook client is able to recognize?Thursday, June 25, 2015 3:52 PM
Answers
-
Thanks, Fei. After submitting this on Stackoverflow, Venkat from MSFT answered my question. It looks like it's possible to do this already with the O365 Mail REST API, but the API doc wasn't updated with info about the method to use.
This Stackoverflow thread contains the answer: https://stackoverflow.com/questions/32749496/how-to-retrieve-itemattachment-contents-from-office-365-rest-api
Wednesday, September 30, 2015 5:53 PM
All replies
-
Hi p4gs,
>>Office 365 Mail REST API doesn't return ItemAttachment contents<<
I am also able to reproduce this issue.
Since this issue is complex, I suggest that you contact the Office Developer Platform Team for this issue via link below:
Customer Feedback for the Office Developer PlatformRegards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Friday, June 26, 2015 7:03 AM -
Thanks, Fei. After submitting this on Stackoverflow, Venkat from MSFT answered my question. It looks like it's possible to do this already with the O365 Mail REST API, but the API doc wasn't updated with info about the method to use.
This Stackoverflow thread contains the answer: https://stackoverflow.com/questions/32749496/how-to-retrieve-itemattachment-contents-from-office-365-rest-api
Wednesday, September 30, 2015 5:53 PM