Share via

‎ Microsoft Graph API

Prasanna Suraweera 20 Reputation points
2025-09-22T08:00:39.07+00:00

API Endpoint: Request ID: <<removed PII>> Client Request ID: <<removed PII>>

Problem: We are creating a message in a shared mailbox from its raw MIME content, fetched from another user's mailbox. The API call is failing with a deserialization error, even though we are providing the data as a Blob with the correct Content-Type.

Microsoft 365 and Office | Development | Other
0 comments No comments

Answer accepted by question author

Gabriel-N 18,050 Reputation points Microsoft External Staff Moderator
2025-09-22T09:31:56.5533333+00:00

Dear Prasanna Suraweera

Thank you for posting your question on the Microsoft Q&A forum, and thank you to Emmanuel Santana for the initial response.

Based on my research, the “UnableToDeserializePostBody” error you encountered when calling POST /users/{sharedMailboxId}/messages is likely due to how the MIME content is included in the request body. Microsoft Graph requires the entire RFC 822 message to be base64-encoded and provided as a plain text string, with the Content-Type header set to text/plain.

If raw MIME bytes or a binary Blob are sent, the API attempts to interpret the body as Base64 and fails, resulting in the deserialization error. This often happens when MIME content is retrieved using GET /messages/{id}/$value (which returns raw bytes) and then posted without encoding. To resolve this, base64-encode the full MIME content before sending and ensure no extra characters or JSON wrappers are added.

For more details, please refer to the official documentation:

Please note that this is a suggestion and may not immediately resolve the issue. For a more accurate investigation, I would need additional details such as:

  • The code snippet you are using to make the request
  • The full error message (including any inner error details)
  • How the code is being triggered (e.g., SDK, REST call, language)

Looking forward to your feedback.


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

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Emmanuel Santana 39,215 Reputation points Independent Advisor
    2025-09-22T08:58:25.09+00:00

    Hello. How exactly are you retrieving and formatting the MIME content from the source mailbox? Are you using /messages/{id}/$value or /messages/{id}/mimeContent to get it?

    Was this answer helpful?


Your answer

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