Office.MailboxEvent interface

MailboxEvent 对象作为参数传递到加载项的事件处理程序,该加载项实现 基于事件的激活,包括 智能警报集成垃圾邮件报告功能解密。 它允许加载项向 Outlook 客户端表明它已完成处理事件。

注解

API 集:邮箱 1.10

最低权限级别受限

适用的 Outlook 模式:Compose 或 Read

重要说明

方法

completed(options)

指示基于事件的垃圾邮件报告加载项或解密加载项已完成事件处理。

方法详细信息

completed(options)

指示基于事件的垃圾邮件报告加载项或解密加载项已完成事件处理。

completed(options?: SmartAlertsEventCompletedOptions | SpamReportingEventCompletedOptions | MessageDecryptEventCompletedOptions): void;

参数

options

Office.SmartAlertsEventCompletedOptions | Office.SpamReportingEventCompletedOptions | Office.MessageDecryptEventCompletedOptions

可选。 指定在处理完事件时基于事件的垃圾邮件报告或解密加载项的行为的对象。

返回

void

注解

API 集:邮箱 1.10

最低权限级别受限

适用的 Outlook 模式:Compose 或 Read

重要说明

  • 邮箱 1.14 中引入了对集成垃圾邮件报告功能的支持。

  • 邮箱 1.12 中引入了对向参数分配SmartAlertsEventCompletedOptionsoptions对象的支持。

  • 邮箱 1.16 中引入了对解密功能的支持。

示例

// The following example sets the subject when a new message is composed.
function onNewMessageComposeHandler(event) {
    const subject = "Set by an event-based add-in!";
    Office.context.mailbox.item.subject.setAsync(
        subject,
        {
            asyncContext: event,
        },
        (asyncResult) => {
            const event = asyncResult.asyncContext;
            if (asyncResult.status === Office.AsyncResultStatus.Failed) {
                console.error("Failed to set subject: " + asyncResult.error.message);
                event.completed();
                return;
            }

            // Signal to the Outlook client that the event has been processed.
            console.log("Successfully set the subject.");
            event.completed();
        }
    );
}