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 took long time to invoke add-in, if Mail has large attachments & large body. #4897

Open nveeranki-dg opened 1 week ago

nveeranki-dg commented 1 week ago

Provide required information needed to triage your issue

Testing the Addin on Mac, Trying to send the mail with Large body & Large attachments.while converted the large body into PDF, it's size almost 7 MB and attachment's size 15 MB.Composed mail by adding large body content & large attachments, click on send button.After clicked on send button,Time taken to get the first log in outlook add-in was 10 to 14 seconds, where as add-in taken 5 to 6 seconds to process the data and return from add-in.due to this long processing time we are getting smart alerts stating that add-in taking longer time than expected for processing, one more alert after finished processing like below.

smart alert1:

Screenshot 2024-09-16 at 12 53 28 PM

smart alert2:

Screenshot 2024-09-16 at 1 40 27 PM

Your Environment

Expected behavior

Outlook should not take long time to invoke add-in.so that we can get rid of these smart alerts.

Current behavior

Outlook taking long time to invoke add-in.due to this we are getting smart alerts. Collected the time stamps for this scenario.

`Click on send:14:06:11
Outlook add-in first log:14:06:22
first alert:14:06:27
Return from add-in:14:06:27
second alert:14:06:28`

Attached js file used simple-outlook-addin.js.zip

Log from the outlook application. log.txt

Steps to reproduce

  1. Install the add-in.
  2. host the files on localhost or remote.
  3. Compose the mail by adding the large content in body and large attachments also.
  4. Send the mail and observe the smart alerts.
kumarshrey-msft commented 1 week ago

@nveeranki-dg Can you please provide details like the impacted platform and host you are seeing this issue on? Please update the post and fill all the relevant information in the expected format.

nveeranki-dg commented 1 week ago

@kumarshrey-msft updated the post with required information.

kumarshrey-msft commented 3 days ago

Hi @nveeranki-dg, thanks for updating the post and providing additional details. I created a custom add-in & used the JS code you provided but was unable to reproduce this scenario at my end. Can you please confirm whether you are doing any additional post processing as well apart from what you shared in the JS code above?

In general, Smart alert add-ins are intended to be short-running and lightweight, and the prompt you observe is shown in case the add-in processing takes longer than expected. As such, I encourage you to further optimize your code, for example you can leverage OnMessageRecipientsChanged or OnMessageAttachmentsChanged events for doing attachment related processing. You can read more about the best practices related to the same here.

A few additional queries:

  1. Does your add-in also include other Launch Events? If yes, you can host the add-in on a private repo and give access to @exextoc to help us repro this scenario.
  2. Do you have any other Smart alert add-ins running as well?
  3. Are you observing this only for PDFs?