0

I have encountered a problem that when I open a dialog through the dialog API the dialog will be shown properly (picture of loaded dialog), but when I click outside the dialog and press the Esc key the Add-in will be closed but the dialog will remain visible and became fully unresponsive to further user interactions (picture of stuck dialog). In this case I did not get any error messages (even my event handler for the DialogEventReceived was not called).

If I click inside the dialog and press the Esc key the dialog will be closed properly (like after pressing the 'X' button of the dialog). In this case my event handler will be called and there I get the 12006 error code.

Originally I ran into this issue in an Outlook Add-in built with Angular. Later I created an Outlook Web Add-in project which only opens the requested dialog, and with that Add-in I also ran into the same issue.

The function where I call the dialog API (from the Outlook Web Add-in project):

function openDialogAsIframe() {
    var dialog;
    Office.context.ui.displayDialogAsync(window.location.origin + "/Dialog.html",
        { height: 16, width: 14, displayInIframe: true }, (asyncResult) => {
            dialog = asyncResult.value;
            dialog.addEventHandler(Office.EventType.DialogMessageReceived, (arg) => {
                console.log(arg.message);
                dialog.close();
            });
            dialog.addEventHandler(Office.EventType.DialogEventReceived, (arg) => {
                console.log(arg.error);
                dialog.close();
            });
        });
}

I reproduced this issue with the following web browsers:

  • Google Chrome - Version 93.0.4577.63
  • Microsoft Edge - Version 93.0.961.38
  • Firefox - 91.0.2

Is there any solution for this issue?

  • We are not able to reproduce it. 1. Can you share a small sample manifest where this issue is evident ? 2. When did you first notice it, was it working smoothly earlier ? 3. Does it reproduce always? – Outlook Add-ins Team - MSFT Sep 06 '21 at 05:15
  • Thanks for the fast reply! I've noticed this issue when I started to use the dialog API in the Angular Add-in project, and since that this issue was always reproduceable in that Angular project and also in the Outlook Web Add-in project. Here is the link to the manifest of the sample Outlook Web Add-in project: https://pastebin.com/nH0dehZn – Péter Csonka Sep 06 '21 at 09:55
  • We installed the add-in through your manifest. But When we click on Open Dialog, Dialog doesn't open and in console we see this error: Uncaught TypeError: Cannot read property 'addEventHandler' of undefined at DialogHelper.js:6 at Object.OSF.DDA.issueAsyncResult (outlook-web-16.01.js:20) at Object.k [as onComplete] (outlook-web-16.01.js:20) at Object.callback (outlook-web-16.01.js:20) at M (outlook-web-16.01.js:20) – Outlook Add-ins Team - MSFT Sep 07 '21 at 04:03
  • With which web browser have you run into this error? With the browsers I originally mentioned I haven't encountered any errors like what you wrote. Today I tried out the sample Outlook Web Add-in project also in Internet Explorer, where I indeed ran into similar issue. I've fixed the origin of the issue and I've published the modified Add-in which can be installed through the manifest that I linked in my previous comment, can you check it again? Anyway now with Internet Explorer it works fine and even the Esc key issue doesn't appear there, but it is still happening with the other browsers. – Péter Csonka Sep 07 '21 at 12:30
  • With Internet Explorer when I use the corrected sample Outlook Web Add-in the event handler for the DialogEventReceived always got called with the "12006" error code in every case if I press the Esc key, but this still doesn't happen with the other browsers if I click outside the displayed dialog. – Péter Csonka Sep 07 '21 at 12:54
  • We uninstalled and installed the add-in again but its still the same error for us: Uncaught TypeError: Cannot read property 'addEventHandler' of undefined at DialogHelper.js:6 at Object.OSF.DDA.issueAsyncResult (outlook-web-16.01.js:20) at Object.k [as onComplete] (outlook-web-16.01.js:20) at Object.callback (outlook-web-16.01.js:20) at M (outlook-web-16.01.js:20) Tried in Chrome and Edge – Outlook Add-ins Team - MSFT Sep 08 '21 at 04:12
  • Unfortunately I still couldn't reproduce this issue, I've made some further changes in the code, would you please try it one more time? With the modified sample Outlook Add-in under the "Open Dialog" button the processed result of the dialogCallback will be also displayed. Now the implementation of the displayed dialog (Dialog.html) and also the caller to the dialog API (DialogHelper.js) are the same (except the URL given at the displayDialogAsync calls) as in the Office Add-in Dialog API Example provided by Microsoft: https://github.com/OfficeDev/Office-Add-in-Dialog-API-Simple-Example – Péter Csonka Sep 08 '21 at 13:03
  • So now when we click on "Open Dialog" button, the processed result is shown as "An internal error has occurred.". There is no error in console now. – Outlook Add-ins Team - MSFT Sep 10 '21 at 05:04
  • Based on the error messages I think that the problem might originate from the office-js. Or do you have any suggestions that what went wrong? It's strange that I call the dialog API the same way in the sample Add-in as in the example from Microsoft, but it's not working on your side. I've read the documentation of "Internal Error" but it can be caused by quite a few things. – Péter Csonka Sep 10 '21 at 15:01

0 Answers0