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

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

icon

A reference to an icon that is defined in the manifest. It appears in the infobar area. It is applicable if the type is InformationalMessage, and is required if the type is InsightMessage. Specifying this parameter for an unsupported type results in an exception.

Note: At present, the custom icon is displayed in Outlook on Windows only and not on other clients (e.g., Mac, web browser).

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.

If type is ProgressIndicator or ErrorMessage, an icon is automatically supplied and the message is not persistent. Therefore the icon and persistent properties are not valid for these types of messages. Including them will result in an ArgumentException.

If type is ProgressIndicator, the developer should remove or replace the progress indicator when the action is complete.

Important: Only the InformationalMessage type is supported in Outlook on Android and on iOS.

Property Details

icon

A reference to an icon that is defined in the manifest. It appears in the infobar area. It is applicable if the type is InformationalMessage, and is required if the type is InsightMessage. Specifying this parameter for an unsupported type results in an exception.

Note: At present, the custom icon is displayed in Outlook on Windows only and not on other clients (e.g., Mac, web browser).

icon?: string;

Property Value

string

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.

If type is ProgressIndicator or ErrorMessage, an icon is automatically supplied and the message is not persistent. Therefore the icon and persistent properties are not valid for these types of messages. Including them will result in an ArgumentException.

If type is ProgressIndicator, the developer should remove or replace the progress indicator when the action is complete.

Important: Only the InformationalMessage type is supported in Outlook on Android and on iOS.

type: MailboxEnums.ItemNotificationMessageType | string;

Property Value