Office.AddinCommands.EventCompletedOptions interface

Specifies the behavior of an on-send add-in in Outlook when it completes processing an ItemSend event.

Remarks

[ API set: Mailbox 1.8 ]

Minimum permission level: restricted

Applicable Outlook mode: Compose

Properties

allowEvent

When you use the completed method to signal completion of an event handler, this value indicates if the handled event should continue execution or be canceled. For example, an on-send add-in that handles the ItemSend event can set allowEvent to false to cancel the sending of a message.

Property Details

allowEvent

When you use the completed method to signal completion of an event handler, this value indicates if the handled event should continue execution or be canceled. For example, an on-send add-in that handles the ItemSend event can set allowEvent to false to cancel the sending of a message.

allowEvent?: boolean;

Property Value

boolean

Remarks

[ API set: Mailbox 1.8 ]

Minimum permission level (Outlook): restricted

Applicable Outlook mode: Compose

Examples

// In this example, the checkMessage function was registered as an event handler for ItemSend.
function checkMessage(event) {
    // Get the item being sent.
    const outgoingMsg = Office.context.mailbox.item;

    // Check if subject contains "BLOCK".
    outgoingMsg.subject.getAsync(function (result) {
        // Subject is in `result.value`.
        // If search term "BLOCK" is found, don't send the message.
        const notFound = -1;
        const allowEvent = (result.value.indexOf('BLOCK') === notFound);
        event.completed({ allowEvent: allowEvent });
    });
}