Open senden9 opened 2 months ago
We are facing the same issue. The Office.EventType.SelectedItemsChanged
event consistently fails to fire on OWA and new Outlook when changing the email selection from one to two selected emails just as @senden9 has outlined. This bug significantly impacts add-ins supporting item multi-select as the selected emails shown in the add-in task pane do not reflect the actual email selection in the user's mailbox which is confusing to users. The suggested work arounds using a timer or subscribing to the Office.EventType.ItemChanged
event are insufficient as they defeat the purpose of the Office.EventType.SelectedItemsChanged
event which is specifically designed to deal with item selection changes in item multi-select add ins as documented here
Multi Item selection does not trigger reliably in new Outlook Desktop and Outlook Web. In the old outlook Desktop it works fine.
Your Environment
Expected behavior
Office.context.mailbox.addHandlerAsync(Office.EventType.SelectedItemsChanged, …)
triggers on every change of selection. Like documented at https://learn.microsoft.com/en-us/javascript/api/requirement-sets/outlook/requirement-set-1.14/office?view=common-js-preview#eventtype-string:Current behavior
Office.context.mailbox.addHandlerAsync(Office.EventType.SelectedItemsChanged, …)
triggers only on some changes. See video below.Steps to reproduce
Link to live example(s)
The Repository https://github.com/senden9/OfficeJS-Issue-Example/ contains the Add-In for this example. The Javascript code can be found at https://github.com/senden9/OfficeJS-Issue-Example/blob/88711d940dfaff927d44c61e2b7e7ab618b3f121/src/taskpane/taskpane.js#L8-L46
Provide additional details
In the old Outlook desktop the example works perfectly fine.
Workaround
Workaround: Either use a timer to check with
Office.context.mailbox.getSelectedItemsAsync
for selected mails or check also for multible mails whenOffice.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged, …
triggers.Useful logs
Screencast:
https://github.com/OfficeDev/office-js/assets/905857/c5451507-752f-4bf7-9381-d5290fd55ed2