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. 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

Methods

completed(options)

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

Method Details

completed(options)

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

completed(options?: SmartAlertsEventCompletedOptions): void;

Parameters

options
Office.SmartAlertsEventCompletedOptions

Optional. An object that specifies the behavior of an event-based add-in when it completes processing an event.

Returns

void

Remarks

[ API set: Mailbox 1.10 ]

Minimum permission level: restricted

Applicable Outlook mode: Compose or Read

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