Graph - Provide access to ItemAttachment bytes
In the EWS api we could download an email attachment that is itself an email (say message.eml) as a byte array, untouched. This does not appear to be possible in the Graph API. The itemAttachment is visible using $expand=microsoft.graph.itemattachment/item but only as exploded json and attachments to the itemAttachment itself are not there.
I work in a Search and Rescue environment (lives are at stake) and from an auditing/quality/completeness perspective I need to know exactly what was attached to the email (the bytes). I think the API needs to be enhanced to provide this. Can I suggest that the api allows an ItemAttachment to be treated exactly as a FileAttachment (returning contentBytes)?
This feature is in public beta. You can fetch the raw byte streams of file attachments and MIME content of item attachments. You can read more about the feature @ https://docs.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-beta#get-the-raw-contents-of-a-file-or-item-attachment
I am an another vote for having the Byte Content of Item attachment in the Graph API. Otherwise migration from EWS is a pain.
Charles Bronzwaer commented
It is possible to get attachments of attachments (even further down) with the beta version of the OutlookAPI. This is the query https://outlook.office.com/api/beta/users/USER/messages/MESSAGEID/attachments/ATTACHMENTID?$expand=microsoft.outlookservices.itemattachment/item/
This does not work with the Graph API, not even the beta. With Graph you are forced to get the *.eml file and recursively parse it in your own application. Will this feature above be added to Graph? Ideally not in the way the Outlook API implemented it because now you get all the recursive attachments in one response.... Just give us an attachmentID per attachment that can be queried separately.
Remco Borst commented
At the moment i am stuck on the exact same issue. I an trying to read all e-mails into our ticket system. Some of these e-mails contain e-mail attachments of which i can only retreive the contents of.. but never any underlying attachments. This could be virtually never ending, so the best option would be to just download the message like mentioned above. Please add this!