Office.context.ui.displayDialogAsync对话框未关闭

时间:2017-10-04 13:22:51

标签: typescript office-js outlook-web-addins

当按下对话框的关闭按钮(x)(显示在iframe中)时,显示的iframe将被删除,但包括关闭按钮和标题的面板仍然保留。我在日志中发现了以下错误,但我不确定TypeError: o.get_contextActivationManager is not a function中是否发生了相关owa.clientnext.extensibility.js:7:1898

Exchange服务器版本为 15.1(Build 1034.26)。 Probelm发生在

  • Firefox 55.0.3(32位)
  • Chrome 61.0.3163.100(Offizieller Build)(64位)
  • IE 11.0.9600.18792

我使用以下函数来创建对话框:

export async function GetFiles(): Promise<string[]> {

    return new Promise<string[]>((resolve, reject) => {

        Office.context.ui.displayDialogAsync(window.location.origin +
            '/exchangeAddIn/UploadDialog/index.html',
            {
                height: 50,
                width: 50,
                displayInIframe: true
            },
            (asyncResult: Office.AsyncResult) => {
                if (asyncResult.status === Office.AsyncResultStatus.Failed) {
                    Logger.error('Faild Dialog %o', asyncResult);
                    reject();
                }
                else {
                    let dialogHandler = asyncResult.value as Office.DialogHandler;

                    dialogHandler.addEventHandler(
                        Office.EventType.DialogMessageReceived, (args: any) => {
                            dialogHandler.close();
                            if (args.message == null) {
                                resolve();
                            }
                            let array = JSON.parse(args.message) as string[];
                            resolve(array);
                        });

                    dialogHandler.addEventHandler(
                        Office.EventType.DialogEventReceived, (arg: any) => {
                            reject();
                        });
                }
            });
    });

}

0 个答案:

没有答案