If I have a message with an .eml (i.e. message/rfc822) attachment in my mailbox, fetching the message via the REST API returns a Message with a single ItemAttachment
. That ItemAttachment
encapsulates a Microsoft.OutlookServices.Message
representing the attached message. The attached Message
object has a null Id
, so we can't fetch it directly. But what if we want to fetch the content of one of its attachments?
Message in Inbox
\--> Attachments
\--> ItemAttachment
\--> Item
\--> Attachments
\--> FileAttachment <-- (want the content of this)
That second-level FileAttachment has an @odata.id
of:
https://outlook.office.com/api/beta/Users('1985bb55-77bd-4936-868d-a1606dc735ff@3bb3f5a2-37a8-4451-b57b-ef37f0b2a1fa')/('')/Attachments('AAMkAGQ3MzU1BBc2LWFjNTItNDk4Mi1iZTdlLTM3NGM0NzY5NTNmYgBGAAAAAACI4ZQOxnCPTpOe8P6IYO9gBwA_fgVM0BybQ5W_noJvz6hgAAAAAAEMAAA_fgVM0BybQ5W_noJvz6hgAAB2hYE9AAACEgAQAA_BBM8zEqJPrcr4BJ-cOyUSABAAlLV-2suqwEGuRduQ43E9pg==')
But any attempts to fetch that object will fail because of the missing message_id path segment:
{"error":{"code":"RequestBroker-ParseUri","message":"Empty segment encountered in request URL. Please make sure that a valid request URL is specified."}}
How can I fetch the content of that attachment?