How to store email attachment in another mail into .eml file using Graph api?

VEERA MALLESH Diyyala 0 Reputation points
2024-11-20T05:26:00.3566667+00:00

The contentBytes property is not directly available for .msg attachments because they are treated as itemAttachment rather than fileAttachment.

 

According to the documentation, for an item attachment that is a contact, event, or message, the raw contents returned is in MIME format not in ContentBytes.

 

This is by design and using Graph API we can't read the content bytes of an item Attachment.

 

But in my batch, we are receiving .msg files as an attachment along with other attachments in mail. It comes as Item attachment.

 

In case of File Attachment, we are able to read content bytes. But in case of Item attachment, how can we read content bytes?

 

We have to read content of email attachment which is attached in another email and store that attached email to .eml/msg file.

 

Suppose we have pdf, doc, msg attachments in email. We will be able to read content of pdf file and store it to .pdf file.

 

Similar way have to read email attachment (.msg) content also and store it as .eml file.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,506 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.