OWA:对话框API支持 [英] OWA: Dialog API support

查看:85
本文介绍了OWA:对话框API支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Outlook加载项中使用一个对话框进行身份验证.外接程序中有逻辑,首先检查对话框API支持,然后检查外接程序是否带有框架-在这种情况下,它将弹出一个新窗口进行身份验证.最近,OWA的对话框API亮起,并给我们带来了两个问题.

We use a dialog in our Outlook add-in for authentication. We have logic in our add-in that first checks for dialog API support, then checks if the add-in is framed - in which case it pops a new window for authentication instead. Recently the dialog API lit up for OWA, and has caused us a couple issues.

我们修复了一些以前的问题,这些问题与执行身份验证(使用ADAL.js)和初始化Office的顺序有关.但是,一旦我们过去了,就不会出现对话框可以使用Office.context.ui.messageParent与外接程序进行通讯.

We fixed some previous issues relating to the order in which we performed authentication (we use ADAL.js) and initializing Office. However, once we were past those, it doesn't appear the dialog can communicate back to the add-in using Office.context.ui.messageParent.

此外,即使加载项订阅了Microsoft.Office.WebExtension.EventType.DialogEventReceived事件,在关闭对话框时它们也不会被触发(通常,关闭对话框会返回一个12006错误代码,我们会加以保护).

Additionally, even though the add-in subscribes to Microsoft.Office.WebExtension.EventType.DialogEventReceived events, they don't get fired when the dialog is closed (typically closing a dialog returns a 12006 error code, which we guard for).

我创建了一个简单的Outlook加载项,它仅打开一个对话框,并验证了它仍然无法与OWA中的加载项进行通信.我已经在下面添加了代码.

I created a simple Outlook add-in that solely opens a dialog, and verified that it still can't communicate with the add-in in OWA. I've included the code below.

附加代码:

Office.initialize = function (reason) {
    $(document).ready(function () {
        var resultArea = $("span");
        $("button").click(function () {
            resultArea.text("Opening dialog");
            Office.context.ui.displayDialogAsync(
                window.location.origin + "/TestAddin/Dialog.html",
                { height: 75, width: 25 },
                function (asyncResult) {
                    if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
                        var dialog = asyncResult.value;
                        dialog.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogMessageReceived, function handleAuthDialogMessage(message) {
                            dialog.close();
                            resultArea.text(message);
                        });
                        dialog.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogEventReceived, function handleAuthDialogMessage(message) {
                            resultArea.text("Event encountered");
                        });
                    } else {
                        resultArea.text("Dialog failed");
                    }
                });
        });
    })
};

对话框代码:

Office.initialize = function (reason) {
    $(document).ready(function () {
        Office.context.ui.messageParent("dialog-opened");
    })
};

现在,我已经对插件进行了调整,以便在检查或使用对话框API之前先检查插件是否带有框架(在这种情况下,它将打开一个新的身份验证窗口).这种方法使我们可以修复生产错误,并重新启用OWA身份验证;但是,我想在对话框正常工作或我们的插件固定后使用它:)

For now I've adjusted our add-in to first check to see if it is framed (in which case it opens a new window for authentication) before it checks for or uses the dialog API. This approach allows us to fix our production bug, and re-enable OWA authentication; however, I would like to uptake the dialog once it's working or our add-in is fixed :)

有人知道这个问题吗?

-更新2/22 ---

--- Update 2/22 ---

该对话框现在可以向父母发送消息了.不幸的是,仍然存在一个突出的错误,即关闭对话框不会触发将事件发送到加载项.

It appears that the dialog can now message parents. Unfortunately there's still an outstanding bug where closing the dialog doesn't trigger an event to be sent to the add-in.

推荐答案

无法重现邮件父问题.

关于DialogEventReceived事件在关闭对话框时不会触发-这是一个已知问题,我们正在努力解决,但感谢您的举报!

Regarding DialogEventReceived events not firing when the dialog is closed - this is a known issue that we are working on a fix for already, but thanks for reporting!

这篇关于OWA:对话框API支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆