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 · 7 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

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

4 participants