office365apioutlook-restapioffice365-restapi

How to retrieve attachments of an ItemAttachment from Office 365 REST API?


Assume I have an event (that has attachments) attached to my email, then I will use the api call provided here and get the event details, but I see that "Id" property is missing in the response. The same happens for messages as attachments. My problem is if I do not have the eventId or messageId, then I am not able to get their attachments.

Please see the below picture which shows the response from the provided api call here.

attached picture


Solution

  • As mentioned here, we can use the following api call:

    GET https://outlook.office.com/api/beta/me/messages/[message-id]?$expand=Attachments($expand=Microsoft.OutlookServices.ItemAttachment/Item($expand=Microsoft.OutlookServices.Event/Attachments))