Office.MailboxEvent interface

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

注解

[ API set: Mailbox 1.10 ]

最低权限级别受限

适用的 Outlook 模式:撰写或阅读

方法

completed(options)

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

方法详细信息

completed(options)

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

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

参数

options

Office.SmartAlertsEventCompletedOptions | Office.SpamReportingEventCompletedOptions

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

返回

void

注解

[ API set: Mailbox 1.10 ]

最低权限级别受限

适用的 Outlook 模式:撰写或阅读

示例

// 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();
        }
    );
}