Closed abdumanas-plutoflume closed 5 months ago
Thanks for reporting this issue @abdumanas-plutoflume ! Tagging @exextoc to take a look into this issue.
Thanks for reporting this issue regarding ItemSend. We are able to repro the same at our end. It has been put on our backlog. We unfortunately have no timelines to share at this point.
Internal tracking id: Office: 190632
@exextoc I can confirm that, although Outlook for windows displays a default message, it still shuts down the add-in and all progress is lost. So the issue exists not just in OWA but Outlook for windows. I have updated the Issue description.
Provide required information needed to triage your issue
When the onSend event handler add-in is in progress, if the user clicks on another email, Outlook hangs and the add-in breaks.
Once user clicks on another email, the
Office.js
APIs invoked from the add-in starts to fail. Even if the event is released from the addin using thecompleted
method, email is not released. The send button is greyed out and we have to refresh outlook and try again.Interestingly, the
displayDialogAsync
seemed to work even when the other APIs failed. So I think only the Office.js APIs related toOffice.context.mailbox
are failing. Might be because of the change incontext
.Outlook for Mac closes the writing pane once email is sent (ideal UX in my opinion) and even if user switches to a different email, the add-in processing isn't affected.
Outlook for windows displays a default alert but the add-in is still shutdown and all progress is lost. So issue exists in OWA and Outlook for windows
I can try to block the user from clicking elsewhere by opening a dialog box, but it could result in other issues like #3097 . And it should be handled gracefully like in either Outlook for Mac.
Your Environment
Expected behavior
The add-in should continue processing even if user switches to a different email, like in Outlook for Mac.
Current behavior
The add-in breaks if user switches to a different email while it's in progress.
Steps to reproduce
Create an onSend event handler add-in
Paste the following in commands.ts
/ global global, Office, self, window /
Office.onReady(() => { // If needed, Office.js is ready to be called console.log("here"); });
/**
@param event */ async function onSendCallback(event: Office.AddinCommands.Event) { try {
for (let i = 0; i < 100_000; i++) { console.log(i); } const response = await OfficeRuntime.auth.getAccessToken({ allowSignInPrompt: true, });
console.log("response", response); } catch (error) { console.error(JSON.stringify(error as any)); } finally { event.completed(); } }
function getGlobal() { return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : undefined; }
const g = getGlobal() as any;
// The add-in command functions need to be available in global scope g.onSendCallback = onSendCallback;