OfficeDev/office-js

OnMessageAttachmentsChanged missing multiple attachment events on initialise

Closed this issue · 7 comments

When using outlook's OnMessageAttachmentsChanged event and adding multiple attachments at the same time (by selecting multiple files). Less than expected number of attachment events are emitted (it varies).

Provide required information needed to triage your issue

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: Reproduced on Office on the web, PC desktop and Mac
  • Host [Excel, Word, PowerPoint, etc.]: Outlook
  • Operating System: Windows and MacOS
  • Browser (if using Office on the web): Chrome

Expected behavior

When multiple attachments are uploaded at the same time an event should be emitted for each of them.

Current behavior

When initialising the addin it misses at least one attachment event. (If 3 files are attached it will emit 2 events or sometimes 1 event).

After initialising the addin it will correctly emit attachment events for each attachment added. But of course closing an email

Steps to reproduce

  1. Load test addin provided below
  2. New email
  3. Add attachments
  4. Browse this computer
  5. Select at least 2 files
  6. Observe in the console that at least one event is missing from the logs

Link to live example(s)

Basic reproduction addin

Office.initialize = () => {
  console.log("init");
};

function onAttachmentsChanged(event) {
  console.log(`Attachment changed ${JSON.stringify(event)}`);
  event.completed();
}

Provide additional details

Configure with a manifest that defines

<LaunchEvent Type="OnMessageAttachmentsChanged" FunctionName="onAttachmentsChanged"/>

Context

When relying on this event to track attachments, missing attachments becomes an issue.

Video of the issue

I will submit a video later of the issue happening

Here is the video of how to reproduce the issue

outlook_missing_events_conv.mp4

@ruwi-next you mentioned "Office on the web, PC desktop and Mac" under platforms.
Do you mean that you see this happening in the Windows Outlook client and on the Mac Outlook client (separately from Office on the web)?
If so, can you please provide a video for the Mac and PC Desktop clients as well? The video only shows the web-based outlook but not the clients.

Hi yes, I have attached a video of the same behaviour in the new Outlook Windows Desktop app. Upon retesting it appears this does work correctly on the Outlook Mac Desktop app. As for classic Outlook on Windows we do not target this and so I am not able to test this.

outlook_mising_events_desktop.mp4

For anyone else running into this issue it can be mitigated by registering the onMessageCompose event. This will initialize your addin before the attachments events are dispatched meaning the bug, what I assume is a race condition with initialising the addin, isn't triggered.

Hi @ruwi-next, we haven't been able to reproduce the issue. Could you please share the manifest you're using when experiencing the issue? This will help us investigate further. It's great to hear that you've found a workaround.

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

This issue has been closed due to inactivity. Please comment if you still need assistance and we'll re-open the issue.