Outlook Mail REST API: send message with attachment

Anton Koval' picture Anton Koval' · Aug 25, 2015 · Viewed 7.7k times · Source

I'm trying to use next API method: https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#SendMessages. Sending messages without attachments works just fine, but I can not understand how to send message with attachments.

According to docs, Message structure can contain array of Attachments with items of type https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#RESTAPIResourcesFileAttachment . Problem is in the field ContentBytes -- it is impossible to dump bytes to JSON before sending request to this API method (actually dumping any BLOB to JSON is nonsense).

How should I pass Attachments using REST API at all?

Thanks.

Answer

Jason Johnston picture Jason Johnston · Aug 25, 2015

There's an example of passing the attachment on that page: https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#SendMessageOnTheFly