In Office.context.mailbox.item.getInitializationContextAsync, asyncResult is supposed to be a string, but instead it is coming as JSON object in Outlook Desktop.

Naga Varun Kamichetty 0 Reputation points Microsoft Employee
2024-04-05T12:07:53.92+00:00

We’ve encountered a discrepancy with mailboxItem.getInitializationContextAsync. In Outlook on the web(OWA), asyncResult.value returns a string, whereas in the desktop version, it returns a JSON object.

https://learn.microsoft.com/en-us/office/dev/add-ins/reference/objectmodel/preview-requirement-set/office.context.mailbox.item#methods

Because of this inconsistency, JSON.parse of async result fails on the desktop version, while it works fine in the browser.

https://learn.microsoft.com/en-us/javascript/api/outlook/office.messageread?view=outlook-js-preview&preserve-view=true#outlook-office-messageread-getinitializationcontextasync-member(1)

Microsoft 365 and Office | Development | Other
Outlook | Windows | Classic Outlook for Windows | For business
{count} votes

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.