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 `ItemSend`: Web Add-in with COM Add-in causing issues together #4010

Closed alexm-plutoflume closed 7 months ago

alexm-plutoflume commented 8 months ago

Provide required information needed to triage your issue

A customer has noted that when using our Web Add-in and another COM Add-in that both utilize the ItemSend event they are seeing unexpected behavior.

When the Add-ins run, the Web Add-in runs first, then the COM Add-in. If they cancel send with the COM Add-in, edit the email, then resend the email, and this time let it send instead of cancelling, the old version of the email gets sent not the edited version.

This only happens when they are replying or forwarding emails in the reading pane, not popped out.

Your Environment

Platform: Outlook Windows Version: Version 2308 (Build 16731.20316) (could be others as well)

Expected behavior

If a user has a Web Add-in and a COM Add-in that both interact with the ItemSend event, if they cancel send, edit their email, then send again, the new edited version should be sent not the old version.

Current behavior

If a user has a Web Add-in and a COM Add-in that both interact with the ItemSend event, if they cancel send, edit their email, then send again, the old version of the email is sent.

This only happens when they are replying or forwarding emails in the reading pane, not popped out. The behavior is correct for popped out emails.

Steps to reproduce

Have a COM Add-in & Web Add-in installed that both interact with the ItemSend event.

The COM Add-in should be able to cancel the send.

To reproduce:

  1. Reply to an email in the reading pane
  2. Send the email - the Web Add-in should run, then the COM Add-in should run but allow you to cancel sending.
  3. Cancel sending the email and make some edits.
  4. Send the email again but this time let the COM Add-in send the email.
  5. Note that the email that gets sent is the old email that you originally sent, not the edited one.

Context

Customers will frequently still use COM Add-ins and Web Add-ins together. This is undesirable behavior.

Useful logs

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

alexm-plutoflume commented 7 months ago

@exextoc Hi - is there any update on this?

timwan10 commented 7 months ago

In general it is not recommended to use Web Add-ins alongside COM Add-ins especially when they interact with each other. (this situation is not supported).

That being said, I cannot repro this behavior.

I observed:

1) Reply to an Mail in READING PANE with Body "ASDF" 2) Click Send 3) Web Add-in Runs, Does Some stuff and allows the send. 4) Now the Event goes to the COM Add-in, which does some stuff, and sets Cancel = True 5) I edit the Body to say "QWERTY" 6) Hit Send Again. Web Add-ins are NOT run. (which may be a bug) 7) COM Add-in Gets the event. And sets Cancel = false. 8) Mail is Sent 9) Mail Received is "QWERTY"

Is there something else the COM add-in is doing, or the Web Add-in is doing, that might help repro the behavior.

For clarity I tested this by using VBA and just set up an event handler. My Web Add-in does nothing except delay a bit, and then eventually allow the send.
(I manually changed the value of Cancel as I needed)

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Debug.Print Item
    Cancel = True
End Sub
alexm-plutoflume commented 7 months ago

Hi sorry, I just wanted to follow up. You say

In general it is not recommended to use Web Add-ins alongside COM Add-ins especially when they interact with each o other. (this situation is not supported).

Is this officially documented anywhere we can share with customers?

timwan10 commented 3 weeks ago

Sorry for the late update, but this was officially documented a while back here;

https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/outlook-add-ins-overview

image