Outlook Web App add in Dialog Api messageParent not working

北慕城南 提交于 2019-12-10 11:36:41

问题


I am developing a Outlook add in and was checking out the authentication flow (Microsoft login) for my app. I tried using the dialog api to achieve this but was not able to pass message from the dialog to the task pane after successful sign in.

index.js:

var fullUrl = 'https://localhost:3000/src/templates/auth.html'
Office.context.ui.displayDialogAsync(fullUrl,
{height: 40, width: 40}, function (result) {
        console.log("Dialog has initialized. Wiring up events");
        _dlg = result.value;
        console.log(result.status);
        _dlg.addEventHandler(Office.EventType.DialogMessageReceived, function(responseMessage){ console.log(responseMessage);});
    });

Dialog box:

Office.initialize = function (reason) {
    $(document).ready(function () {
        Office.context.ui.messageParent("Message 1");
    }
}

In the dialog console I get this,

outlook-web-16.01.debug.js:4587 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://outlook.live.com') does not match the recipient window's origin ('https://localhost:3000').

Any idea what could be the problem?

来源:https://stackoverflow.com/questions/53505354/outlook-web-app-add-in-dialog-api-messageparent-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!