OfficeDev / office-js-docs

[ARCHIVED] Microsoft Office Add-ins API Reference Documentation
https://docs.microsoft.com/javascript/api/overview/office
398 stars 247 forks source link

IE 11 Office.context.ui.displayDialogAsync error 12006 #1496

Closed roginneil closed 6 years ago

roginneil commented 6 years ago

Hi. I would like to ask why do i get error 12006 (The dialog box was closed, usually because the user chooses the X button.) even though I didn't close the dialog. I get this error in IE 11, but everything is working with chrome and firefox.

Here is my code: `private _addinDialog(): Promise { return new Promise((resolve, reject) => { Office.context.ui.displayDialogAsync(this.url, { width: this.size.width$, height: this.size.height$ }, (result: Office.AsyncResult) => { if (result.status === Office.AsyncResultStatus.Failed) { reject(result.error); } let dialog = result.value as Office.DialogHandler; // tslint:disable-next-line:no-any dialog.addEventHandler(Office.EventType.DialogMessageReceived, (args: any) => { let dlg = this._safeParse(args.message); resolve(dlg); dialog.close(); });

            // tslint:disable-next-line:no-any
            dialog.addEventHandler(Office.EventType.DialogEventReceived, (args: any) => {
                reject(new DialogError(args.message, args.error));
                dialog.close();
            });
        });
    });
}`

Everytime Office.context.ui.displayDialogAsync runs on my IE, this is the result: d2

But for chrome, this is the result and the add in works: d1

Thanks for your answers.

Rick-Kirkham commented 6 years ago

@roginneil We use the issues of this repo to report errors in the documentation. Your technical question should be raised on either StackOverflow (tag it office-js) or in the issues for the office-js repo, which is the repo for the actual Office JavaScript code.

When you raise the issue please clarify my understanding of the problem: 1) You are testing your add-in with Office Online (not Office desktop).

2) It works in Firefox and Chrome.

3) In IE, the result.status value is succeeded; but the result.error is defined and is 12006.

If my understanding is correct you are getting an error AND a succeeded status. I don't think there should ever be both an error and a succeeded status; so this looks like a bug. I recommend you raise the issue on the issues for the office-js repo.