OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
670 stars 96 forks source link

In Outlook, when more than 100 items are selected, no events are raised to the add-in #3847

Open VasilyIvanov opened 10 months ago

VasilyIvanov commented 10 months ago

We are developing an Outlook add-in that should be able to work with multiple selected emails as documented here. While testing in Outlook Desktop and OWA we noticed a problem that appears when we select more than 100 email items. In fact, our add-in is not notified when the user selects more than 100 emails. According to the documentation, there is the Office.EventType.SelectedItemsChanged event that is fired when the user changes email selection in Outlook. However, add-ins get no information when the user selects more than 100 email items.

Your Environment

Expected behavior

We suppose that an add-in should be somehow notified that the use has selected more than 100 email items in Outlook. This could be done by the existing Office.EventType.SelectedItemsChanged event, another event, or an error with an unique error code could be thrown.

Current behavior

The addin button isn't enabled if we have more than 100 emails selected before starting the add-in but if the add-in is already started and we go from 99 to 100, we are notified, then anything above 100 doesn't notify us. From time to time we may get the following error. image The error is inconsistent and we cannot predict when we can get it. Tested by two developers, the first one got the error always when selected more than 100 emails, the second one got the error sometimes when selected more than 100 emails. This error is not documented so we cannot rely on it. We are not sure that the error code 9064 is unique and cannot be used in other errors.

Steps to reproduce

  1. Start an add-in that subscribes to the Office.EventType.SelectedItemsChanged event in Outlook Desktop or OWA.
  2. Select 99 emails. You will get an event showing 99 emails selected.
  3. Select 100 emails. You will get an event showing 100 emails selected.
  4. Select 101 emails. You will get neither an event nor an error showing that more than 100 emails have been selected. Probably you may get an undocumented error.

Link to live example(s)

  1. This test add-in could be used to reproduce but any other add-in that subscribes to the Office.EventType.SelectedItemsChanged event will work for you.

Provide additional details

The issue occurs in both Outlook Desktop and OWA.

Context

We would like to get a notification that the user has selected more than 100 emails in Outlook. There might be inconsistency between the user selection and the state of our add-in. The user might select more than 100 emails while the add-in will have no information about this fact and the latest event received by the add-in will inform about 100 selected emails. We understand that add-ins cannot process more than 100 selected emails because of the limit set by the framework. However, in our view, add-ins should be notified that the user has selected more than 100 emails.

Useful logs

exextoc commented 10 months ago

This is by design, please check the section "Item multi-select behavior and limitations" from the document. A maximum of 100 messages can be selected at a time. Currently the feature of supporting more than 100 emails, you requested, is not a part of the product. We track Outlook add-in feature requests on our Tech Community Page. Please submit your request there and choose the appropriate label(s). Feature requests on Tech Community are considered, when we go through our planning process.

mrebuffet commented 10 months ago

Thank you for your reply.

Before going any further, I would like to specify that we are NOT requesting to support more messages than the current limitation.

We are reporting an inconsistency around the email selection and are trying to find a reliable workaround for it. As stated in the documentation if a user selects more the maximum number of emails, the add-in button is not enabled, and the user cannot start the add-in. This works as expected.

However, if the add-in is already started and pinned with a selection under the maximum limit (> 1 and <100), we cannot find a reliable way to notify the user that they went above the maximum number of messages when they select more than the maximum. This is a problem because if we have no way of identifying this scenario, users may think we will process all the selected messages while only the first 100 will be included.

Could you please provide a reliable way of detecting when the user has exceeded the maximum so we can display something relevant in a pinned add-in?

We are looking for any of these possibilities:

VasilyIvanov commented 9 months ago

We have provided feedback. Could you please update your answer before closing this issue? Thanks.

elegault commented 9 months ago

+1 on this issue. There are other problems with getSelectedItemsAsync() in Outlook Online and the New Outlook (see #3800), and we were hoping to at least support Outlook for Windows to handle our email upload add-in's requirements to work with multiple emails (as we could with our VSTO version). But this bug is now a feature killer if we cannot even warn the user that their selection is invalid. This function should be taken offline until it works perfectly in at least one supported platform.

zhngx1 commented 9 months ago

Thanks for reporting this issue regarding when more than 100 items are selected, no events are raised to the add-in. It has been put on our backlog. We unfortunately have no timelines to share at this point

Internal tracking id: Office: 8601032

JuaneloJuanelo commented 8 months ago

@elegault i think the bug we have here is that we are not failing the getSelectedItemsAsync call when the user selects more that 100 Messages, that way you can advise the user to select less items. This will satisfy the scenario, right?

elegault commented 8 months ago

@JuaneloJuanelo Yes, I believe so!

JuaneloJuanelo commented 8 months ago

we are working on a fix this month for this.

mrebuffet commented 8 months ago

Thanks for the update @JuaneloJuanelo Looking forward to seeing the fix in action. Hopefully this issue #3846 (Internal tracking id: Office: 8565220) in the same area can also be addressed in this release :-)