Building custom solutions that extend, automate, and integrate Microsoft 365 apps.
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.