REST API question : downloading attachments

New Contributor

If I drag and drop an email attachment from a web outlook (that is from open in a browser)  to my desktop application I see the following JSON string in the drop event.



attachmentV{"itemType":"attachment","attachmentFile":{"attachmentItemId":"AAMkADhmNz......","name":"feb invoices archive.pdf","size":64276,"fileType":5,"type":"ItemIdAttachment:#Exchange"}}



so I have the attachmentItemId but no messageId…. And yet the only endpoints I see for the rest API require a messageId.


e.g. GET{message_id}/attachments/{attachment_id}


Is there a way to download an attachment without knowing the message id? Or of finding the messageid that this attachment belongs to?

1 Reply

best i could find so far is to search messages for the file name


and then loop through the returned messages and their attachments looking for the specific id.

not ideal... but it's working.

n.b. you have to replace any "/" characters with "-" and any "+" with "_" in the attachmentid when comparing with the id returned in the search.