Prevent On-Send add-in error when user clicks different message

Prevent On-Send add-in error when user clicks different message
0

Upvotes

Upvote

 Jan 20 2022
0 Comments 
New

Currently, when an on-send add-in is running after clicking "Send" on a reply, an error will be displayed and the message will be saved as a draft if the user clicks away to another message if the add-in has not completed.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: PC Desktop
  • Host [Excel, Word, PowerPoint, etc.]: Outlook
  • Operating System: Windows 10

Expected behavior

Complete the processing of the on-send add-in in the background even if the user clicks away from the message.

Current behavior

An error is shown:
"An add-in prevented this message from being sent. It will be saved as a draft"

and (if the reply is popped out):
"Add-ins are still running on this message. The message won't be sent until the add-in completes. Do you want to wait for them to finish?"

Steps to reproduce

  1. Create an outlook add-in with the "On-Send feature" as described here
  2. Install the on-send add-in
  3. Reply to a message (don't pop out)
  4. Click send. Then immediately click away to another message.
    (Note: Same thing for a popped-out reply -- just a different error message is shown)

Provide additional details

A Stack Overflow question was asked here: https://stackoverflow.com/questions/61345763/how-to-prevent-on-send-add-in-errors-when-user-clicks-elsewhere

Context

When we have on-send processing that may take a few seconds to complete, we want the user to be able to continue using Outlook as they would (which may include navigating to another message). There should be some way to handle this appropriately so that the on-send can run in the background and if an error occurs, then the user could be notified appropriately.

 

See Github issue here: https://github.com/OfficeDev/office-js/issues/2377