Office.context.mailbox.item does not update without the ItemChanged listener #5340
Labels
Area: Outlook
Issue related to Outlook add-ins
Possible-Solution
Similar-Issue
Type: product feature request
Office JS ideas that should be posted to aka.ms/m365dev-suggestions (formerly User Voice.)
Description:
I'm experiencing an issue with the Office JavaScript API for Outlook. When switching emails within the task pane, the Office.context.mailbox.item object does not update automatically.
Steps to Reproduce:
Open the task pane of an Outlook add-in.
Retrieve the value of Office.context.mailbox.item.
Switch to a different email in the Outlook client.
Retrieve Office.context.mailbox.item again without reloading the add-in.
Expected Behavior:
The Office.context.mailbox.item object should automatically update when switching emails.
Actual Behavior:
The item value remains unchanged, still showing the data from the previous email.
Current Workaround:
The issue can be resolved by adding a listener for the Office.EventType.ItemChanged event and retrieving Office.context.mailbox.item inside the event callback.
Office.context.mailbox.addHandlerAsync( Office.EventType.ItemChanged, () => { console.log("Item updated:", Office.context.mailbox.item); } );
Additional Notes:
It would be helpful if Office.context.mailbox.item updated automatically without requiring an explicit event listener.
The text was updated successfully, but these errors were encountered: