Office.EventType enum

Specifies the kind of event that was raised. Returned by the type property of an *EventArgs object.

Add-ins for Project support the Office.EventType.ResourceSelectionChanged, Office.EventType.TaskSelectionChanged, and Office.EventType.ViewSelectionChanged event types.

Only task pane add-ins for Outlook support Mailbox API set event types.

Remarks

Examples

// This sample shows how to register an event handler in Outlook.
Office.onReady(() => {
    // Registers an event handler to identify when messages are selected.
    Office.context.mailbox.addHandlerAsync(Office.EventType.SelectedItemsChanged, getMessageProperties, (asyncResult) => {
        if (asyncResult.status === Office.AsyncResultStatus.Failed) {
            console.log(asyncResult.error.message);
            return;
        }

        console.log("Event handler added for the SelectedItemsChanged event.");
    });
});

function getMessageProperties() {
    // Retrieves the selected messages' properties and logs them to the console.
    Office.context.mailbox.getSelectedItemsAsync((asyncResult) => {
        if (asyncResult.status === Office.AsyncResultStatus.Failed) {
            console.log(asyncResult.error.message);
            return;
        }

        asyncResult.value.forEach((message) => {
            console.log(`Item ID: ${message.itemId}`);
            console.log(`Subject: ${message.subject}`);
            console.log(`Item type: ${message.itemType}`);
            console.log(`Item mode: ${message.itemMode}`);
        });
    });
}

Fields

ActiveViewChanged

A Document.ActiveViewChanged event was raised in PowerPoint.

AppointmentTimeChanged

Occurs when any date or time of the selected appointment or series is changed in Outlook.

Important: This event can only be handled in a task pane. Function commands can't register a handler for this event.

To add an event handler for the AppointmentTimeChanged event, use the addHandlerAsync method of the Item object. The event handler receives an argument of type Office.AppointmentTimeChangedEventArgs.

[ API set: Mailbox 1.7 ]

AttachmentsChanged

Occurs when an attachment is added to or removed from an item.

Important: This event can only be handled in a task pane. Function commands can't register a handler for this event.

To add an event handler for the AttachmentsChanged event, use the addHandlerAsync method of the Item object. The event handler receives an argument of type Office.AttachmentsChangedEventArgs.

[ API set: Mailbox 1.8 ]

BindingDataChanged

Occurs when data within the binding is changed in Excel or Word.

To add an event handler for the BindingDataChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type Office.BindingDataChangedEventArgs.

BindingSelectionChanged

Occurs when the selection is changed within the binding in Excel or Word.

To add an event handler for the BindingSelectionChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type Office.BindingSelectionChangedEventArgs.

DialogEventReceived

Triggers when Dialog has an event, such as dialog closed or dialog navigation failed.

DialogMessageReceived

Triggers when a dialog sends a message via messageParent.

DialogParentMessageReceived

Triggers when a host page sends a message to a child dialog box with messageChild.

DocumentSelectionChanged

Triggers when a document-level selection happens in Excel or Word.

EnhancedLocationsChanged

Occurs when the appointment location is changed in Outlook.

Important: This event can only be handled in a task pane. Function commands can't register a handler for this event.

To add an event handler for the EnhancedLocationsChanged event, use the addHandlerAsync method of the Item object. The event handler receives an argument of type Office.EnhancedLocationsChangedEventArgs.

[ API set: Mailbox 1.8 ]

InfobarClicked

Occurs in Outlook when an action is selected on a notification message with a defined custom action. Currently, "Dismiss" is the only supported action that fires this event.

Important: This event can only be handled in a task pane. Function commands can't register a handler for this event.

To add an event handler for the InfobarClicked event, use the addHandlerAsync method of the Item object. The event handler receives an argument of type Office.InfobarClickedEventArgs.

[ API set: Mailbox 1.10 ]

ItemChanged

Occurs when a different Outlook item is selected for viewing while the task pane is pinned.

Important: This event can only be handled in a task pane. Function commands can't register a handler for this event.

To add an event handler for the ItemChanged event, use the addHandlerAsync method of the Mailbox object.

[ API set: Mailbox 1.5 ]

NodeDeleted

Triggers when a customXmlPart node is deleted.

NodeInserted

Triggers when a customXmlPart node is inserted.

NodeReplaced

Triggers when a customXmlPart node is replaced.

OfficeThemeChanged

Occurs when the OfficeTheme is changed in Outlook.

To add an event handler for the OfficeThemeChanged event, use the addHandlerAsync method of the Mailbox object. The event handler receives an argument of type Office.OfficeThemeChangedEventArgs.

Important:

  • The OfficeThemeChanged event can only be handled in a task pane. Function commands can't register a handler for this event.

  • The OfficeThemeChanged event isn't supported in add-ins that implement event-based activation.

[ API set: Mailbox 1.14 ]

RecipientsChanged

Occurs when the recipient list of the selected item or the appointment location is changed in Outlook.

Important: This event can only be handled in a task pane. Function commands can't register a handler for this event.

To add an event handler for the RecipientsChanged event, use the addHandlerAsync method of the Item object. The event handler receives an argument of type Office.RecipientsChangedEventArgs.

[ API set: Mailbox 1.7 ]

RecurrenceChanged

Occurs when the recurrence pattern of the selected series is changed in Outlook.

Important: This event can only be handled in a task pane. Function commands can't register a handler for this event.

To add an event handler for the RecurrenceChanged event, use the addHandlerAsync method of the Item object. The event handler receives an argument of type Office.RecurrenceChangedEventArgs.

[ API set: Mailbox 1.7 ]

ResourceSelectionChanged

Triggers when a Resource selection happens in Project.

SelectedItemsChanged

Occurs in Outlook when one or more messages are selected or deselected.

Important: This event can only be handled in a task pane. Function commands can't register a handler for this event.

To add an event handler for the SelectedItemsChanged event, use the addHandlerAsync method of the Mailbox object.

[ API set: Mailbox 1.13 ]

SensitivityLabelChanged

Occurs in Outlook when the sensitivity label of a message or appointment changes.

Important: This event can only be handled in a task pane. Function commands can't register a handler for this event.

To add an event handler for the SensitivityLabelChanged event, use the addHandlerAsync method of the Item object. The event handler receives an argument of type Office.SensitivityLabelChangedEventArgs.

[ API set: Mailbox 1.13 ]

SettingsChanged

A Settings.settingsChanged event was raised in Excel, PowerPoint, or Word.

SpamReporting

Occurs in Outlook when an unsolicited message is reported. The event handler receives an argument of type Office.SpamReportingEventArgs.

[ API set: Mailbox 1.14 ]

TaskSelectionChanged

Triggers when a Task selection happens in Project.

ViewSelectionChanged

Triggers when a View selection happens in Project.