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)

Outlook
Outlook
A family of Microsoft email and calendar products.
3,818 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,896 questions
{count} votes

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.