Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Office.context.mailbox.item.saveAsync fails during OnSend function on Outlook for web #5345

Open
victorcalarasu opened this issue Feb 2, 2025 · 18 comments
Labels
Area: Outlook Issue related to Outlook add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback Possible-Solution Similar-Issue

Comments

@victorcalarasu
Copy link

victorcalarasu commented Feb 2, 2025

I have an Add-in created for Outlook Web which adds headers to emails in order to save them securely. It operated both through Task Pane and on the OnSend functionality of Outlook Web.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: Office on the web
  • Host [Excel, Word, PowerPoint, etc.]: Outlook
  • Office version number: ______
  • Operating System: Windows
  • Browser (if using Office on the web): Chrome/Edge/Firefox

Expected behavior

When pressing the Outlook Send Button (OnSend function), the mail is sent successfully.
What I want to do is get the draft ID in order to send the item using Microsoft Graph API

Current behavior

When pressing the Outlook Send Button the Office.context.mailbox.item.saveAsync() function fails with :

error: OSF_DDA_Error
code: 9021
message: "Connection error occurred while trying to save the item on the server."
name: "SaveError"

this wasn't happening before and we didn't do any change here.
If I save the draft manually, gets automatically saved by Outlook or do the same flow using the Task Pane (opening the add-in through the Apps button), it works correctly.

It is only happening on new emails.

Steps to reproduce

Call the saveAsync() function during the onSend process.

Link to live example(s)




Provide additional details




Context

Mails can no longer be sent.
What I want to do is get the draft ID in order to send the item using Microsoft Graph API

Useful logs

Image

Copy link

github-actions bot commented Feb 2, 2025

Here are some similar issues that might help you. Please check if they can solve your problem.


Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)

Solution 1:

One reason why this can happen is if your add-in does not register for the ItemChanged event. Can you add support for that to your add-in (if you haven't already) and see if that resolves this issue? If your add-in doesn't support this event, the Office.context.mailbox.item object in the add-in becomes stale, resulting in the error you are experiencing.

Reference:

Solution 2:

This scenario occurs when calling Office.context.mailbox.item.saveAsync on a new Calendar item that has not been sent yet. This is a known issue and we are looking into a solution to resolve this so that the API can be used as designed. The API should behave as designed in Mail and on Existing Calendar items.

Reference:

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Feb 2, 2025
@exextoc exextoc added Area: Outlook Issue related to Outlook add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Feb 2, 2025
@victorcalarasu
Copy link
Author

victorcalarasu commented Feb 2, 2025

These suggestions sadly do not seem to help

Also, the exact same code used to work last week with no problems (for multiple months)

@dmitriikashin-outreach
Copy link

Our telemetry indicates high amount of hanging Office.context.mailbox.item.saveAsync requests.

Internally we Timeout and Cancel them after 30 seconds, but this API is a crucial peace of our UX, and we wish we could see less of such hanging calls.

Similar situation is with the following APIs:

Office.CustomProperties.saveAsync
Office.context.mailbox.item.loadCustomPropertiesAsync
Office.context.mailbox.item.to.getAsync
Office.context.mailbox.item.cc.getAsync
Office.context.mailbox.item.bcc.getAsync

It comes together with the

"Error: [Office API error] name: Internal Error, code: 5001, message: An internal error has occurred., diagnostics: undefined"

and

"Error: [Office API error] name: GenericResponseError, code: 9020, message: An internal error has occurred., diagnostics: undefined"

errors codes.

@patilganesh-msft
Copy link

Thank you @victorcalarasu for reporting this.
While we check this from our end, could you please share the logs by following the process: https://github.com/OfficeDev/office-js/wiki/Collecting-log-files-for-Outlook-Add%E2%80%90ins-issues and give the access to exextoc?

@patilganesh-msft patilganesh-msft added Needs: author feedback Waiting for author (creator) of Issue to provide more info and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Feb 3, 2025
@victorcalarasu
Copy link
Author

@patilganesh-msft Thank you for your response, I will ask for permissions to share the logs with exextoc.
Please keep me posted if you find anything in the meantime.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: author feedback Waiting for author (creator) of Issue to provide more info labels Feb 3, 2025
@victorcalarasu
Copy link
Author

@patilganesh-msft I've added exextoc to my private repository containing some logs. Let me know if I can help in any other way.

@victorcalarasu
Copy link
Author

victorcalarasu commented Feb 4, 2025

@patilganesh-msft @exextoc Any updates regarding this topic? it's important for us

@AndreasDvrs
Copy link

Hello, getting this behaviour as well - any ideas on what might be causing this or any fix or workaround that could facilitate the current situation..?

@exextoc
Copy link
Collaborator

exextoc commented Feb 7, 2025

Hi @victorcalarasu

Thank you for providing the logs.
I can see repeated POST requests to "https://eu-office.events.data.microsoft.com/OneCollector/1.0/?cors=true&content-type=application/x-json-stream&w=0
".
This endpoint if for Telemetry collection.
NO_AUTH also suggests that requests are unauthenticated.
Is the add-in explicitly sending excessive analytics data using Office.js APIs? You may re-try disabling them.

@victorcalarasu
Copy link
Author

victorcalarasu commented Feb 7, 2025

Thank you for your response @exextoc !
Regarding the sending of excessive analytics, aren't these automatic diagnostic events? From the best of my knowledge, we don't do this manually/explicitly. How do I disable them?

This still makes me wonder about this: Why did our code, between the 30th/31st of January stop working suddenly? And why is it working fine through the Task Pane or if we save the draft manually?

It's just the saveAsync function which started failing and returning the result from the picture in the issue

@victorcalarasu
Copy link
Author

Could the release on the 30th of January impact this in any way? (https://learn.microsoft.com/en-us/officeupdates/current-channel#version-2501-january-30)

@SE-Hubert
Copy link

SE-Hubert commented Feb 10, 2025

Having the same issue here... Saving the item from a side panel works fine but saving the item from the OnSend event causes the same issue. Error: 9021

And like @victorcalarasu said, our code was working fine earlier but it stopped working around the 30/31 of January.

Any workarounds?

@SecureExchanges
Copy link

We are facing exactly the same issue. It's quite concerning because this is not the first time we are encountering problems of this kind. It used to work, but suddenly, from one day to the next, nothing works anymore. I understand that there is a big system behind it, but are you able to guarantee stability for your product to your clients?

Without wanting to sound accusatory, are you ready to welcome millions of users, or are you still in a testing phase?

@mobisw-msft
Copy link

Hey @victorcalarasu , thanks for reporting this issue- we are able to reproduce the same. We have tracked this item in our backlog. However, we have no timelines to share at this point.

@dmitriikashin-outreach - We have only tracked the issue with item.saveAsync failing. The issue with the latency with these and other APIs seem to be a different issue- it would be great if you could open a different Github issue for the same, with some telemetry numbers that you observe and other details you think would help.

Internal Tracking ID: 5372914

@victorcalarasu
Copy link
Author

hello @mobisw-msft , thank you for you response.
This issue has a huge impact on us and we would greatly appreciate if you could prioritize this issue.
Please keep me posted about its status and when it is fixed.

@SE-Hubert
Copy link

I concur with @victorcalarasu , this issue is impacting around 2000 of our users.
Please keep us updated. Thank you

@gauravsoni119
Copy link

@mobisw-msft We are also getting issues with saveAsync method in onSend function. In our case, we are not getting any error but the current message is not getting saved. As per description, this method should saves the current message as a draft. But nothing is saved. However, calling it via EBA or taskpane is working properly. We also changed nothing in our codebase. It was working fine previously.

@SE-Hubert
Copy link

SE-Hubert commented Feb 12, 2025

@mobisw-msft Also forgot to mention, but like @gauravsoni119 said, when saving from a taskpane it works properly. Its only from the ItemSent event that the issue is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Outlook Issue related to Outlook add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback Possible-Solution Similar-Issue
Projects
None yet
Development

No branches or pull requests

9 participants