outlook-web-addins - Outlook 加载项对话框的事件处理程序失败
问题描述
我有从 Outlook 任务窗格调用对话框的加载项。对话框正在正确加载,但即使对话框上有 messageParent 脚本,父任务窗格也没有从对话框接收任何数据。似乎父任务窗格中的事件处理程序根本没有执行。
我正在使用 Outlook 2013 以及 Outlook.com。两种环境都显示相同的行为。
这是我在父任务窗格中的代码:
var dlg;
Office.initialize = function (reason) {
$(document).ready(function () {
$("#btnTestDialog").click(function () {
Office.context.ui.displayDialogAsync("https://localhost:44300/TestDialog.aspx",
{ height: 50, width: 25, displayInIframe: true },
function (result) {
dlg = result.value;
dlg.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogMessageReceived, processTestDialog);
});
});
});
};
function processTestDialog(result) {
var x = "";
dlg.close();
}
这是我的对话框页面(TestDialog.aspx)中的代码
Office.initialize = function (reason) {
$('#btnTest').click(passDataToTest);
$(document).ready(function () {
});
};
function passDataToTest() {
var response = { "status": "sucess", "message": "test" };
Office.context.ui.messageParent(JSON.stringify(response));
}
我已经做了很多研究,在我所有的研究中都说这段代码应该可以工作,但我不知道为什么不能。
解决方案
推荐阅读
- r - 用 purrr 更改 r 中的许多列类型
- ruby-on-rails - Rails:使用远程渲染链接:true 不会触发 AJAX
- typo3 - Persisting value objects in Typo3
- sql - Remove only duplicates from specific Postgresql table
- c++ - 有没有办法使用 using-declaration 来解决“最终覆盖歧义”?
- windows - How to configure Apache reverse proxy domain url to specific url on localhost
- android - Failed to run TensorFlow inference
- java - How to set "pageSize" with the java client of the Google Photos API
- java - 基于图像添加地板或如何优化现有方法
- sql-server - T-SQL / SQL Server:转换后的舍入(十进制)SqlCommand