Share via


Office.NotificationMessageAction interface

通知メッセージのアクションの定義。

注釈

[ API セット: メールボックス 1.10 ]

最小アクセス許可レベル: アイテムの読み取り

適用できる Outlook モード: 新規作成または読み取り

重要: モダン Outlook on the webでは、NotificationMessageActionオブジェクトは新規作成モードでのみ使用できます。

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

// Adds an informational message with actions to the mail item.
const id = $("#notificationId").val().toString();

const itemId = Office.context.mailbox.item.itemId;
const details = {
  type: Office.MailboxEnums.ItemNotificationMessageType.InsightMessage,
  message: "This is an insight notification with id = " + id,
  icon: "icon1",
  actions: [
    {
      actionText: "Open insight",
      actionType: Office.MailboxEnums.ActionType.ShowTaskPane,
      // Identify whether the current mail item is in read or compose mode to set the appropriate commandId value.
      commandId: (itemId == undefined ? "PG.HelpCommand.Compose" : "PG.HelpCommand.Read"),
      contextData: { a: "aValue", b: "bValue" }
    }
  ]
};

Office.context.mailbox.item.notificationMessages.addAsync(id, details, handleResult);

プロパティ

actionText

アクション リンクのテキスト。

actionType

実行するアクションの種類。 ActionType.ShowTaskPane は、サポートされている唯一のアクションです。

commandId

マニフェストで定義されているボタン。

contextData

アクション ボタンがアドインに渡す必要がある JSON データ。

プロパティの詳細

actionText

アクション リンクのテキスト。

actionText: string;

プロパティ値

string

actionType

実行するアクションの種類。 ActionType.ShowTaskPane は、サポートされている唯一のアクションです。

actionType: string | MailboxEnums.ActionType;

プロパティ値

commandId

マニフェストで定義されているボタン。

commandId: string;

プロパティ値

string

contextData

アクション ボタンがアドインに渡す必要がある JSON データ。

contextData: any;

プロパティ値

any

注釈

重要:

  • Outlook on Windows では、 any 種類はバージョン 2402 (ビルド 17308.20000) 以降でサポートされています。 以前のバージョンの Outlook on Windows では、型のみが string サポートされています。

  • JSON データを取得するには、 を呼び出します Office.context.mailboxitem.getInitializationContextAsync。 を使用して JSON.stringify() JSON 文字列を作成し、 プロパティに contextData 割り当てる場合は、取得後に を使用して文字列を JSON.parse() 解析する必要があります。