How to read content bytes from .msg file as attachment in mail using Graph api?

VEERA MALLESH Diyyala 0 Reputation points
2024-10-28T11:53:01.49+00:00

Hi,

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?

Thanks,

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

1 answer

Sort by: Most helpful
  1. Hitesh Pachipulusu - MSFT 3,620 Reputation points Microsoft External Staff
    2024-10-28T12:10:35.9733333+00:00

    Hello VEERA MALLESH Diyyala,

    Thank you for reaching out to Microsoft Support!

    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.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


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.