Outlook 加载项、对话框 API 事件处理程序未触发

Outlook add-in, dialog API eventHandler not firing

我正在为 outlook 加载项开发身份验证流程,并尝试使用对话框 API 在对话框和侧面板之间进行通信。但是,消息传递不起作用,收到消息的事件处理程序从未被调用

侧边栏和对话框都在 https://localhost:3000 上 运行。

我在 Chrome [使用 Mac] 上使用 Outlook 网页版对此进行了测试,并且我已经阅读了 Microsoft 的文档。

侧边栏代码:

let dialog: any;

function processMessage(arg: any) {
  dialog.close();
}

Office.context.ui.displayDialogAsync(
  'https://localhost:3000/testing.html', 
  {height: 35, width: 50},
  (response: any) => {
     dialog = response.value;
     dialog.addEventHandler(Office.EventType.DialogMessageReceived, processMessage);
  });

对话框页面代码:

Office.initialize = function(reason) {
   Office.context.ui.messageParent(true);
};

dialogAsync 回调和 ths messageParent 函数触发正常,但从未调用 processMessage 函数。

添加配置 displayInIframe: true 解决了问题,但这并没有解决无法在 iframe 中显示的页面的问题。

这是变化:

{height: 35, width: 50, displayInIframe: true}