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
689 stars 95 forks source link

Outlook took long time to invoke add-in, if Mail has large attachments & large body. #4897

Closed nveeranki-dg closed 1 month ago

nveeranki-dg commented 2 months 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 2 months 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 2 months ago

@kumarshrey-msft updated the post with required information.

kumarshrey-msft commented 2 months 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?
nveeranki-dg commented 2 months ago

Hi @kumarshrey-msft, regarding additional queries

  1. I don't have any other launch events except OnMessageSend.
  2. I don't have any other add-in's also.
  3. I'm observing this issue while mail should have huge content in body and it should also have some large attachments(>15 MB). in my case attachments are .docx & MP4.

I'm sharing body content below with which i'm able to reproduce the issue.please paste the whole content of below Test.docx in body segment and add some large file(>15MB) as attachment of type docx.

i'm able to reproduce the issue with only OnMessageSend launch event in add-in(which i have shared above) and with the body content shared below , along with some large file as attachment of type doc(>15MB). Test.docx

Swathy-Mothilal commented 2 months ago

Hi @nveeranki-dg, I am still unable to repro the issue with the Test doc that you have shared. The add-in is getting invoked for me with the large attachments and body. Could you please share your add-in manifest and host the add-in in a private repository?Kindly Grant access to @exextoc

Note: I tried creating an add-in with the js file shared above, and I got an error as "Office.context.mailbox.item" is undefined. I tried changing Office.initialize to Office.onReady and moved the mailbox assignment to "handleSendMail" function and it launched the add-in. Kindly follow this link to debug your add-in. And I was unable to see event.completed in the js file too which marks the add-in completion.

microsoft-github-policy-service[bot] commented 1 month ago

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!

microsoft-github-policy-service[bot] commented 1 month ago

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