Edit

Share via


Office.NotificationMessageDetails interface

An array of NotificationMessageDetails objects are returned by the NotificationMessages.getAllAsync method.

Remarks

[ API set: Mailbox 1.3 ]

Minimum permission level: read item

Applicable Outlook mode: Compose or Read

Important: To learn about the different types of notification messages you can implement, see Create notifications for your Outlook add-in.

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/35-notifications/add-getall-remove.yaml

// Gets all the notification messages and their keys for the current mail item.
Office.context.mailbox.item.notificationMessages.getAllAsync((asyncResult) => {
  if (asyncResult.status === Office.AsyncResultStatus.Failed) {
    console.log(asyncResult.error.message);
    return;
  }

  console.log(asyncResult.value);
});

Properties

actions

Specifies actions for the message. Limit: 1 action. This limit doesn't count the "Dismiss" action which is included by default. Only applicable when the type is InsightMessage. Specifying this property for an unsupported type or including too many actions throws an error.

Important: In modern Outlook on the web and new Outlook on Windows, the actions property is available in Compose mode only.

icon

A reference to a custom icon that's defined in the manifest. The icon appears before the notification message in the infobar area. An icon must be specified for InformationalMessage and InsightMessage notifications.

key

The identifier for the notification message.

message

The text of the notification message. Maximum length is 150 characters. If the developer passes in a longer string, an ArgumentOutOfRange exception is thrown.

persistent

Specifies if the message should be persistent. Only applicable when type is InformationalMessage. If true, the message remains until removed by this add-in or dismissed by the user. If false, it is removed when the user navigates to a different item. For error notifications, the message persists until the user sees it once. Specifying this parameter for an unsupported type throws an exception.

type

Specifies the ItemNotificationMessageType of message.

Property Details

actions

Specifies actions for the message. Limit: 1 action. This limit doesn't count the "Dismiss" action which is included by default. Only applicable when the type is InsightMessage. Specifying this property for an unsupported type or including too many actions throws an error.

Important: In modern Outlook on the web and new Outlook on Windows, the actions property is available in Compose mode only.

actions?: NotificationMessageAction[];

Property Value

Remarks

[ API set: Mailbox 1.10 ]

Applicable Outlook mode: Compose or Read

icon

A reference to a custom icon that's defined in the manifest. The icon appears before the notification message in the infobar area. An icon must be specified for InformationalMessage and InsightMessage notifications.

icon?: string;

Property Value

string

Remarks

Important:

  • Currently, the custom icon is only displayed in classic Outlook on Windows.

  • A custom icon is only supported in InformationalMessage and InsightMessage notifications. Specifying an icon for other notification types results in an exception.

  • If your add-in uses the add-in only manifest, the icon must be specified in the Images element of the Resources section of the manifest.

  • If your add-in uses the unified manifest for Microsoft 365, you can't currently customize the icon of an InformationalMessage or InsightMessage notification. The notification uses the first image specified in the "icons" array of the first extensions.ribbons.tabs.groups.controls object of the manifest. Although this is the case, you must still specify a string in the icon property (for example, "icon-16").

key

The identifier for the notification message.

key?: string;

Property Value

string

message

The text of the notification message. Maximum length is 150 characters. If the developer passes in a longer string, an ArgumentOutOfRange exception is thrown.

message: string;

Property Value

string

persistent

Specifies if the message should be persistent. Only applicable when type is InformationalMessage. If true, the message remains until removed by this add-in or dismissed by the user. If false, it is removed when the user navigates to a different item. For error notifications, the message persists until the user sees it once. Specifying this parameter for an unsupported type throws an exception.

persistent?: Boolean;

Property Value

Boolean

type

Specifies the ItemNotificationMessageType of message.

type: MailboxEnums.ItemNotificationMessageType | string;

Property Value

Remarks

Important:

  • For the ProgressIndicator or ErrorMessage types, an icon is automatically supplied and the message isn't persistent. Therefore, the icon and persistent properties aren't valid for these types of messages. Including them will result in an ArgumentException.

  • For the ProgressIndicator type, you should remove or replace the progress indicator when the action is complete.

  • In Outlook on Android and on iOS, only the ProgressIndicator, InformationalMessage, and ErrorMessage notification types are supported.

  • In compose mode, while the style of each notification type varies on other Outlook clients, notifications in Outlook on Android and on iOS all use the same style. The notification message is always prefixed with an informational icon.