Warm tip: This article is reproduced from stackoverflow.com, please click
microsoft-graph microsoft-graph-mail

Getting the attachments of an attached Message in Microsoft Graph

发布于 2020-03-27 10:28:53

I'm trying to retrieve emails using Microsoft Graph(and the Microsoft Graph SDK) and i'm running into the following problem : when the email has another Outlook message attached to it and that message also has attachments, i'm unable to get them.

I'm able to retrieve the attached message with the following query, but I can't do a second expand on attachments as I'm already doing one to get the OutllokItem(message)

/v1.0/users/<UserName>/messages/<MessageId>/attachments/<AttachmentID>?$expand=microsoft.graph.itemattachment/item

Is this possible at all ? Thanks in advance.

Questioner
Maxime Laflamme
Viewed
86
Maxime Laflamme 2019-07-03 23:24

For anyone looking for a solution, there's a feature currently available on beta only that allows you to get the whole message in Mime text format.

To get an attachment

/beta/users/<UserName>/messages/<MessageId>/attachments/<AttachmentID>/$value

To get the full initial message :

/beta/users/<UserName>/messages/<MessageId>/$value

See https://docs.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-beta&tabs=cs for details