Is there a way i can grab the mime contect using Office Add-ins JavaScript API
Cause currently what im doing is i store the mail_id to the db using the Office Add-ins JavaScript API
let mail_id = Office.context.mailbox.item.itemId
and using that mail id, Im doing a Microsoft graph API to grab the mime content using this endpoint
https://graph.microsoft.com/v1.0/me/messages/{mail_id}/$value
Note: i already sanitize the mail id like the "/" to "-" and etc.
some of them are working but some ive encounter some error
Client error:
GET resulted in a
404 Not Found response: {"error":{"code":"ErrorItemNotFound","message":"The specified object was not found in the store., The process failed to (truncated...)
Server error:
GET resulted in a
503 Service Unavailableresponse: {"error":{"code":"ErrorMailboxMoveInProgress","message":"Mailbox move in progress. Try again later., Cross Server access (truncated...)
Please let me know if there's anything i can do about it
Cause currently what im doing is i store the mail_id to the db using the Office Add-ins JavaScript API
The Id your getting with Office.context.mailbox.item.itemId isn't immutable so if the message is moved between folders (by a the user or an inbox rule) then this Id will change and generate the
Client error: GET resulted in a404 Not Found response: {"error":{"code":"ErrorItemNotFound","message":"The specified object was not found in the store., The process failed to (truncated...)
You can translate the Id to an immutable version (which won't change if the message is moved) in the Graph (but this needs to be done before the message is moved) https://learn.microsoft.com/en-us/graph/api/user-translateexchangeids?view=graph-rest-1.0&tabs=http. You can also just do a Get on the item using the prefer header https://learn.microsoft.com/en-us/graph/outlook-immutable-id . One way of handling this in an Addin is covered in https://www.mckennaconsultants.com/process-of-building-an-ms-outlook-add-in-with-microsoft-graph-api/
Server error: GET resulted in a503 Service Unavailableresponse: {"error":{"code":"ErrorMailboxMoveInProgress","message":"Mailbox move in progress. Try again later., Cross Server access (truncated...)
This is something to be expected from time to time as mailboxes are moved between datacentres for operational purposes during maintenance and for load balancing. Generally just wait and retry.