Office.NotificationMessageDetails interface
An array of NotificationMessageDetails
objects are returned by the NotificationMessages.getAllAsync
method.
Remarks
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's defined in the manifest. It appears in the infobar area. It's applicable if the type is |
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 |
persistent | Specifies if the message should be persistent. Only applicable when type is |
type | Specifies the |
Property Details
icon
A reference to an icon that's defined in the manifest. It appears in the infobar area. It's 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.
icon?: string;
Property Value
string
Remarks
Important: Currently, the custom icon is only displayed in classic Outlook on Windows.
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
orErrorMessage
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 anArgumentException
.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
, andErrorMessage
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.
Office Add-ins