Outlook JavaScript加载项在电子邮件加密时不会运行

发布于 2025-02-04 19:30:12 字数 1912 浏览 4 评论 0 原文

我在网络上提供了Outlook的加载项,但是当我加密电子邮件时,我会看到出乎意料的行为。

详细信息如下所述。

■预期行为

执行“ DisplayDialogAsync”方法时显示结果对话框。

■当前行为

即使执行了“ DisplayDialogAsync”方法,并且发送了电子邮件。

■重现

  1. 下载官方样本的步骤。  < 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 /
  2. 将“ app.js”文件的内容重写为以下“ index.js”的源代码,
  3. 在您的本地环境中运行“ yarn start”命令。
  4. 使用清单文件安装加载项。
  5. 写一封电子邮件。
  6. 单击“加密”。
  7. 单击“发送”按钮。

此问题总是发生。 请告诉我如何解决这个问题。

我在视频和源代码上分享此结果。

■视频

■源代码

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 })
        }
      )
    }
  )
}

I'm providing an add-in in Outlook on the Web, but I'm seeing unexpected behavior when I encrypt my email.

Details are described below.

■Expected behavior

The result dialog is displayed when the "displayDialogAsync" method is executed.

■Current behavior

The result dialog is not displayed even though the "displayDialogAsync" method is executed,and an email was sent.

■Steps to reproduce

  1. Download the official sample.
      https://github.com/OfficeDev/Outlook-Add-in-On-Send/blob/master/outlook-add-in-on-send/Contoso%20Message%20Body%20Checker.xml/
  2. Rewrite the contents of the "app.js" file to the source code of following"index.js"
  3. Run the "yarn start" command in your local environment.
  4. Install the add-in with the manifest file.
  5. Write an Email.
  6. Click “Encrypt”.
  7. Click “Send" button.

This problem always occurs.
Please tell me how to solve this problem.

I share this result on video and source code.

■video

https://drive.google.com/file/d/1h3oJSZxObmOXwBw5Z1rjG92U36d9zSFz/view?usp=sharing

■source code

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文