Outlook JavaScript加载项在电子邮件加密时不会运行
我在网络上提供了Outlook的加载项,但是当我加密电子邮件时,我会看到出乎意料的行为。
详细信息如下所述。
■预期行为
执行“ DisplayDialogAsync”方法时显示结果对话框。
■当前行为
即使执行了“ DisplayDialogAsync”方法,并且发送了电子邮件。
■重现
- 下载官方样本的步骤。 < rel =“ nofollow noreferrer”> https://github.com/officedev/outlook-add-ind-ind-ind-ind-ind-in-send/blob/master/master/outlook-add-ind-ind-ind-ind-ind-ind-ind-ind-ind-in-send/contoso%20message%20body%20body%20Checker.xml /
- 将“ app.js”文件的内容重写为以下“ index.js”的源代码,
- 在您的本地环境中运行“ yarn start”命令。
- 使用清单文件安装加载项。
- 写一封电子邮件。
- 单击“加密”。
- 单击“发送”按钮。
此问题总是发生。 请告诉我如何解决这个问题。
我在视频和源代码上分享此结果。
■视频
■源代码
index.js
/*
* Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
* See LICENSE in the project root for license information.
*/
var mailboxItem;
Office.initialize = function (reason) {
mailboxItem = Office.context.mailbox.item;
}
// Entry point for Contoso Message Body Checker add-in before send is allowed.
// <param name="event">MessageSend event is automatically passed by BlockOnSend code to the function specified in the manifest.</param>
function validateBody(event) {
Office.context.ui.displayDialogAsync(
"https://localhost:3000/index.html",
{
height: 65,
width: 40,
displayInIframe: true,
asyncContext: event,
},
(asyncResult) => {
asyncResult.value.addEventHandler(Office.EventType.DialogEventReceived,
(processMessage) => {
asyncResult.value.close()
asyncResult.asyncContext.completed({ allowEvent: false })
}
)
}
)
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论