【发布时间】:2023-03-04 12:49:01
【问题描述】:
我无法将信息发送到 Outlook 加载项中的对话框。这是父级中的 Javascript 代码:
var url2 = window.location.origin+'/dialogbox.html'
var dialog
Office.context.ui.displayDialogAsync(url2, {height: 50, width: 50},
function (asyncResult) {
dialog.messageChild('hello from the parent', {targetOrigin: "*" })
});
messageChild 命令成功完成。
子对话框中的Javascript是:
Office.onReady().then(function() {
Office.context.ui.addHandlerAsync(
Office.EventType.DialogParentMessageReceived,
onMessageFromParent);
});
function onMessageFromParent(arg){
console.log(arg.message)
}
但是,消息“来自父母的问候”并未打印在控制台中。
相反,我在控制台中得到以下两次:
Tracking Prevention blocked access to storage for https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js. [https://localhost:3000/commands.html?_host_Info=Outlook$Win32$16.02$en-US$$$$0]
我做错了什么?如何将消息传递到对话框?
【问题讨论】:
标签: javascript office-js office-addins outlook-web-addins