I have a small script to get all my outlook mails and its attachments. And its working fine.
I can get all the mail and its attachments. However there's particular email that i have a problem.
That email has two attachments "sample.msg" and "sample.pdf". By using this endpoint https://graph.microsoft.com/v1.0/me/messages/{message-id}/attachments
i can get it.
But why is it the sample.msg has no contentBytes?
Is there a way i can get the contentBytes for sample.msg? or there is another endpoint for that particular attachment type?
Please help me to understand this problem.
The @odata.type
itemAttachment indicates that the main message. To get the properties of the item attached to a message, you need to make a separate call and expand item
relationship
GET /v1.0/me/messages/{message_id}/attachments/{attachment_id}?$expand=microsoft.graph.itemattachment/item
Or you can get MIME raw content of the attachment
GET /v1.0/me/messages/{message_id}/attachments/{attachment_id}/$value