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

Outlook: OnMessageCompose event not triggering after sending several emails #3825

Open ArkaiAriza opened 10 months ago

ArkaiAriza commented 10 months ago

After sending several emails in a row, OnMessageCompose event stops truggering

Your Environment

Expected behavior

On composing a message OnMessageCompose event should trigger and its assigned hanlder should run.

Current behavior

After sending several emails (~15) OnMessageCompose event doesn't trigger and its handler doesn't run. Looking in the network tab it seems that the relevant addin files are not being requested.

Steps to reproduce

  1. Have an addin with OnMessageCompose launch event configured and a handler with some easy to check logic.
  2. Compose a new email. Check if the handler is running. Additionally in the network tab check if the relevant addin files are being requested.
  3. If all is good, send the email.
  4. Repeat steps 2 and 3 until the handler doesn't run. Usually takes 15 emails. Sometimes as high as 25.
  5. Once you

Link to live example(s)

Don't have live example.

Context

We need our addin to run for every email. If it stops running after sending several emails our use case is severely affected.

Useful logs

No particualr error arise in this case.

tallen1114 commented 8 months ago

We're experiencing something similar. OnMessageCompose fires for some users and works perfectly, but not for others. It used to work for me, but now is no longer firing. I'm seeing this on Windows desktop client and the web app. In the network tab, I do see it eventually fetching the appropriate addin js that contains the OnMessageCompose handler, BUT - it doesn't happen until I send an email. So it's not there at the time of message compose.

@ArkaiAriza are you still running into this, have you found any workarounds?

ArkaiAriza commented 8 months ago

Hey @tallen1114 . I'm still running into my issue, although yours seem to be a different one. It working for some users and not others points to either a version problem or maybe an auth one? Sory I cannot be of more help.

butterpunk commented 4 months ago

@exextoc any update on this?

tallen1114 commented 4 months ago

Just to update for my case, it was due to the restriction for event-based activation (such as OnMessageCompose) only working for admin-managed deployments. If a user gets the add-in from the store, these events won't fire. https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/autolaunch#deploy-to-users https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/autolaunch-store-options#unrestricted-appsource-listing

Supposedly this is a "temporary" restriction, but it would be very helpful to have any idea for a timeline, as this has been very frustrating for our users.

My issue was different from what was originally described here, but figured I'd throw it out there in case it helps anyone else.

ArkaiAriza commented 4 months ago

As an update, I'm able to reproduce this issue with this very simple addin https://github.com/ArkaiAriza/outlook-sample

It has an OnMessageCompose handler that logs "preprocess" to the console, and an OnMessageSend handler that logs "sending" to the console. After sending several messages (~15) the "preprocess" stops logging (it also stops fetching the relevant addin files) but "sending" keeps logging when you send.

Right now problem seems to be more common in Edge (Version 124.0.2478.97) than on Chrome (Version 124.0.6367.203)

butterpunk commented 4 months ago

@exextoc we believe this is impacting users with new outlook now. Please provide an update. Thanks