Office.MailboxEvent interface

The MailboxEvent object is passed as an argument to the event handler of an add-in that implements event-based activation, including Smart Alerts, or the integrated spam-reporting feature. It allows the add-in to signify to the Outlook client that it has completed processing an event.

Remarks

[ API set: Mailbox 1.10 ]

Minimum permission level: restricted

Applicable Outlook mode: Compose or Read

Important: Support for the integrated spam-reporting feature was introduced in Mailbox 1.14.

Methods

completed()

Indicates that the event-based or spam-reporting add-in has completed processing an event.

Method Details

completed()

Indicates that the event-based or spam-reporting add-in has completed processing an event.

completed(): void;

Returns

void

Remarks

[ API set: Mailbox 1.10 ]

Minimum permission level: restricted

Applicable Outlook mode: Compose or Read

Important:

  • Support for the integrated spam-reporting feature was introduced in Mailbox 1.14.

  • Support to assign a SmartAlertsEventCompletedOptions object to the options parameter was introduced in Mailbox 1.12.

Examples

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