OfficeDev / Office-Add-in-samples

Code samples for Office Add-in development on the Microsoft 365 platform.
MIT License
668 stars 756 forks source link

The Spam Reporting example uses Office.onReady, which will not work on Classic Outlook #798

Closed mikelly-psat closed 10 hours ago

mikelly-psat commented 2 weeks ago

URL of sample

https://github.com/OfficeDev/Office-Add-in-samples/tree/main/Samples/outlook-spam-reporting

Describe the bug

This sample wraps the Office.actions.associate(...) call, which is only needed on classic Outlook for windows, in an Office.onReady(...) call. That onReady call will never be invoked on classic Outlook for this style of add-in, per MS's documentation: https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/spam-reporting

As you develop a spam-reporting add-in that will run in Outlook on Windows, keep the following in mind.

  • Imports aren't currently supported in the JavaScript file that contains the code to handle the spam-reporting event.
  • Code included in the Office.onReady() and Office.initialize functions won't run. You must add any add-in startup logic, such as checking the user's Outlook version, to your event handlers instead.

To Reproduce

Steps to reproduce the behavior:

  1. Install the sample, and try to use it to report a message on classic Outlook for Windows.
  2. The add-in gets stuck showing "Pending..." after you try to submit your report.

Expected behavior

The report doesn't get stuck, and runs to completion correctly.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

Additional context

N/A

AlexJerabek commented 2 weeks ago

Thanks for reporting this @mikelly-psat.

@samantharamon, could you please investigate?

samantharamon commented 4 days ago

Hi @mikelly-psat,

Apologies for the delayed response. I'm currently updating the sample to resolve this issue. I'm creating a separate JS file containing code that applies to classic Outlook on Windows. I should have a fix that you can test out next week.

samantharamon commented 10 hours ago

@mikelly-psat, changes were made in PR #808. If you continue to experience issues, please reopen this issue or create a new one. Thanks.