Share via


Office.AppointmentRead interface

Office.context.mailbox.item の予定出席者モード。

重要: これは内部 Outlook オブジェクトであり、既存のインターフェイスを介して直接公開されることはありません。 これは のモード Office.context.mailbox.itemとして扱う必要があります。 詳細については、「 オブジェクト モデル 」ページを参照してください。

親インターフェイス:

Extends

プロパティ

attachments

項目の添付ファイルを配列として取得します。

body

アイテムの本文を操作するメソッドを提供するオブジェクトを取得します。

dateTimeCreated

アイテムが作成された日時を取得します。

dateTimeModified

アイテムが最後に変更された日時を取得します。

end

予定が終了する日時を取得します。

endプロパティは、Date協定世界時 (UTC) の日付と時刻の値として表されるオブジェクトです。 メソッドを convertToLocalClientTime 使用して、プロパティ値を end クライアントのローカルの日付と時刻に変換できます。

Time.setAsync メソッドを使用して終了時刻を設定する場合、convertToUtcClientTime メソッドを使用して、クライアント上のローカルの時刻をサーバーの UTC に変換する必要があります。

itemClass

選択した予定の Exchange Web Services アイテム クラスを取得します。

IPM.Appointment非定期的な予定とIPM.Appointment.Occurrence定期的な予定の場合は を返します。

itemId

現在の アイテムの Exchange Web Services アイテム識別子 を取得します。

プロパティは itemId 作成モードでは使用できません。 項目識別子が必要な場合は、 メソッドを saveAsync 使用してアイテムをストアに保存できます。これにより、コールバック関数のパラメーター内の asyncResult.value アイテム識別子が返されます。

: プロパティによって itemId 返される識別子は、 Exchange Web Services アイテム識別子と同じです。 itemId プロパティは、Outlook Entry ID または Outlook REST API で使用される ID と同一ではありません。 この値を使用して REST API 呼び出しを行う前に、 を使用して Office.context.mailbox.convertToRestId変換する必要があります。 詳細については、「Outlook アドインから Outlook REST API を使用する」を参照してください。

itemType

インスタンスが表しているアイテムの種類を取得します。

プロパティは itemType 、アイテム オブジェクト インスタンスが ItemType メッセージか予定かを示す列挙値の 1 つを返します。

location

予定の場所を取得します。

location プロパティは、予定の場所を格納した文字列を返します。

normalizedSubject

すべてのプレフィックスが削除された項目の件名を取得します (RE: と FWD:を含む)。

プロパティは normalizedSubject 、メール プログラムによって追加される標準プレフィックス (RE: や FW:など) を含むアイテムの件名を取得します。 これらのプレフィックスが付いたままの状態でアイテムの件名を取得するには、subject プロパティを使用します。

notificationMessages

アイテムの通知メッセージを取得します。

optionalAttendees

イベントの任意出席者へのアクセスを提供します。 オブジェクトの種類とアクセス レベルは、現在の項目のモードによって異なります。

プロパティは optionalAttendees 、会議への各省略可能な出席者の EmailAddressDetails オブジェクトを含む配列を返します。 返される出席者の最大数は、Outlook クライアントによって異なります。

  • Windows: 500 人の出席者

  • Android、クラシック Mac UI、iOS: 100 人の出席者

  • 新しい Mac UI、Web ブラウザー: 制限なし

organizer

会議開催者のメール プロパティを取得します。

requiredAttendees

イベントの必須出席者へのアクセスを提供します。 オブジェクトの種類とアクセス レベルは、現在の項目のモードによって異なります。

プロパティは requiredAttendees 、会議に必要な出席者ごとに EmailAddressDetails オブジェクトを含む配列を返します。 返される出席者の最大数は、Outlook クライアントによって異なります。

  • Windows: 500 人の出席者

  • Android、クラシック Mac UI、iOS: 100 人の出席者

  • 新しい Mac UI、Web ブラウザー: 制限なし

start

予定が開始される日付と時刻を取得します。

startプロパティは、Date協定世界時 (UTC) の日付と時刻の値として表されるオブジェクトです。 メソッドを convertToLocalClientTime 使用して、値をクライアントのローカルの日付と時刻に変換できます。

subject

アイテムの件名フィールドに表示される説明を取得します。

subject プロパティは、電子メール サーバーによって送信されたアイテムの件名全体を取得または設定します。

subject プロパティは文字列を返します。 normalizedSubject RE: や FW: などの先頭のプレフィックスを引いた件名を取得するには、 プロパティを使用します。

メソッド

displayReplyAllForm(formData)

選択したメッセージの送信者とすべての受信者、または開催者、および選択した予定のすべての出席者を含む返信フォームを表示します。

displayReplyForm(formData)

選択したメッセージの送信者のみ、または選択した予定の開催者のみを含む回答フォームが表示されます。

getEntities()

選択したアイテムの本文にあるエンティティを取得します。

getEntitiesByType(entityType)

選択したアイテムの本文内で検出された指定のエンティティ型のすべてのエンティティを含む配列を取得します。

getFilteredEntitiesByName(name)

XML マニフェスト ファイルで定義されている名前付きフィルターを渡す、選択した項目の既知のエンティティを返します。

getRegExMatches()

XML マニフェスト ファイルで定義されている正規表現に一致する、選択した項目の文字列値を返します。

getRegExMatchesByName(name)

XML マニフェスト ファイルで定義されている名前付き正規表現と一致する、選択した項目の文字列値を返します。

getSelectedEntities()

強調表示された一致内で見つかったユーザーが選択しているエンティティを取得します。 強調表示された一致は、コンテキスト アドインに適用されます。

getSelectedRegExMatches()

XML マニフェスト ファイルで定義されている正規表現と一致する強調表示された一致の文字列値を返します。 強調表示された一致は、コンテキスト アドインに適用されます。

loadCustomPropertiesAsync(callback, userContext)

選択されたアイテムのこのアドインのカスタム プロパティを非同期に読み込みます。

カスタム プロパティは、アプリごとに項目ごとにキーと値のペアとして格納されます。 このメソッドはコールバックで CustomProperties オブジェクトを返します。これにより、現在のアイテムと現在のアドインに固有のカスタム プロパティにアクセスするメソッドが提供されます。 カスタム プロパティはアイテムで暗号化されないため、セキュリティで保護されたストレージとして使用しないでください。

カスタム プロパティは asyncResult.value プロパティの CustomProperties オブジェクトとして指定されます。 このオブジェクトを使用して、メール アイテムのカスタム プロパティを取得、設定、保存、および削除できます。

プロパティの詳細

attachments

項目の添付ファイルを配列として取得します。

attachments: AttachmentDetails[];

プロパティ値

注釈

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

適用される Outlook モード: 予定の出席者

: 一部の種類のファイルは、潜在的なセキュリティの問題のために Outlook によってブロックされるため、返されません。 詳細については、「Outlook でブロックされた添付ファイル」を参照してください。

// The following code builds an HTML string with details of all attachments on the current item.
const item = Office.context.mailbox.item;
let outputString = "";

if (item.attachments.length > 0) {
    for (let i = 0 ; i < item.attachments.length ; i++) {
        const attachment = item.attachments[i];
        outputString += "<BR>" + i + ". Name: ";
        outputString += attachment.name;
        outputString += "<BR>ID: " + attachment.id;
        outputString += "<BR>contentType: " + attachment.contentType;
        outputString += "<BR>size: " + attachment.size;
        outputString += "<BR>attachmentType: " + attachment.attachmentType;
        outputString += "<BR>isInline: " + attachment.isInline;
    }
}

console.log(outputString);
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/40-attachments/get-attachments-read.yaml

const attachments = Office.context.mailbox.item.attachments;
console.log(attachments);

body

アイテムの本文を操作するメソッドを提供するオブジェクトを取得します。

body: Body;

プロパティ値

注釈

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

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

適用される Outlook モード: 予定の出席者

// This example gets the body of the item as plain text.
Office.context.mailbox.item.body.getAsync(
    "text",
    { asyncContext: "This is passed to the callback" },
    function callback(result) {
        // Do something with the result.
    });

// The following is an example of the result parameter passed to the callback function.
{
    "value": "TEXT of whole body (including threads below)",
    "status": "succeeded",
    "asyncContext": "This is passed to the callback"
}

dateTimeCreated

アイテムが作成された日時を取得します。

dateTimeCreated: Date;

プロパティ値

Date

注釈

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

適用される Outlook モード: 予定の出席者

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-date-time-created-read.yaml

console.log(`Creation date and time: ${Office.context.mailbox.item.dateTimeCreated}`);

dateTimeModified

アイテムが最後に変更された日時を取得します。

dateTimeModified: Date;

プロパティ値

Date

注釈

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

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

適用される Outlook モード: 予定の出席者

重要: このプロパティは、Outlook on Android または iOS ではサポートされていません。 Outlook モバイルでサポートされている API の詳細については、「モバイル デバイス上の Outlook でサポートされている Outlook JavaScript API」を参照してください。

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-date-time-modified-read.yaml

console.log(`Date and time item last modified: ${Office.context.mailbox.item.dateTimeModified}`);

end

予定が終了する日時を取得します。

endプロパティは、Date協定世界時 (UTC) の日付と時刻の値として表されるオブジェクトです。 メソッドを convertToLocalClientTime 使用して、プロパティ値を end クライアントのローカルの日付と時刻に変換できます。

Time.setAsync メソッドを使用して終了時刻を設定する場合、convertToUtcClientTime メソッドを使用して、クライアント上のローカルの時刻をサーバーの UTC に変換する必要があります。

end: Date;

プロパティ値

Date

注釈

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

適用される Outlook モード: 予定の出席者

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-end-read.yaml

console.log(`Appointment ends: ${Office.context.mailbox.item.end}`);

itemClass

選択した予定の Exchange Web Services アイテム クラスを取得します。

IPM.Appointment非定期的な予定とIPM.Appointment.Occurrence定期的な予定の場合は を返します。

itemClass: string;

プロパティ値

string

注釈

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

適用される Outlook モード: 予定の出席者

重要: 既定の項目クラスを拡張するカスタム クラスを作成できます。 たとえば、 IPM.Appointment.Contosoです。

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-item-class-read.yaml

console.log(`Item class: ${Office.context.mailbox.item.itemClass}`);

itemId

現在の アイテムの Exchange Web Services アイテム識別子 を取得します。

プロパティは itemId 作成モードでは使用できません。 項目識別子が必要な場合は、 メソッドを saveAsync 使用してアイテムをストアに保存できます。これにより、コールバック関数のパラメーター内の asyncResult.value アイテム識別子が返されます。

: プロパティによって itemId 返される識別子は、 Exchange Web Services アイテム識別子と同じです。 itemId プロパティは、Outlook Entry ID または Outlook REST API で使用される ID と同一ではありません。 この値を使用して REST API 呼び出しを行う前に、 を使用して Office.context.mailbox.convertToRestId変換する必要があります。 詳細については、「Outlook アドインから Outlook REST API を使用する」を参照してください。

itemId: string;

プロパティ値

string

注釈

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

適用される Outlook モード: 予定の出席者

// The following code checks for the presence of an item
// identifier. If the `itemId` property returns `null` or
// `undefined`, it saves the item to the store and gets the
// item identifier from the asynchronous result.
// **Important**: `saveAsync` was introduced with requirement set 1.3
// so you can't get the `itemId` in Compose mode in earlier sets.
let itemId = Office.context.mailbox.item.itemId;
if (itemId === null || itemId == undefined) {
    Office.context.mailbox.item.saveAsync(function(result) {
        itemId = result.value;
    });
}

itemType

インスタンスが表しているアイテムの種類を取得します。

プロパティは itemType 、アイテム オブジェクト インスタンスが ItemType メッセージか予定かを示す列挙値の 1 つを返します。

itemType: MailboxEnums.ItemType | string;

プロパティ値

注釈

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

適用される Outlook モード: 予定の出席者

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-item-type.yaml

const itemType = Office.context.mailbox.item.itemType;
switch (itemType) {
    case Office.MailboxEnums.ItemType.Appointment:
        console.log(`Current item is an ${itemType}.`);
        break;
    case Office.MailboxEnums.ItemType.Message:
        console.log(`Current item is a ${itemType}. A message could be an email, meeting request, meeting response, or meeting cancellation.`);
        break;
}

location

予定の場所を取得します。

location プロパティは、予定の場所を格納した文字列を返します。

location: string;

プロパティ値

string

注釈

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

適用される Outlook モード: 予定の出席者

const location = Office.context.mailbox.item.location;
console.log("location: " + location);
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-location-read.yaml

console.log(`Appointment location: ${Office.context.mailbox.item.location}`);

normalizedSubject

すべてのプレフィックスが削除された項目の件名を取得します (RE: と FWD:を含む)。

プロパティは normalizedSubject 、メール プログラムによって追加される標準プレフィックス (RE: や FW:など) を含むアイテムの件名を取得します。 これらのプレフィックスが付いたままの状態でアイテムの件名を取得するには、subject プロパティを使用します。

normalizedSubject: string;

プロパティ値

string

注釈

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

適用される Outlook モード: 予定の出席者

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-normalized-subject-read.yaml

console.log(`Normalized subject: ${Office.context.mailbox.item.normalizedSubject}`);

notificationMessages

アイテムの通知メッセージを取得します。

notificationMessages: NotificationMessages;

プロパティ値

注釈

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

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

適用される Outlook モード: 予定の出席者

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

// Adds a progress indicator to the mail item.
const id = $("#notificationId").val().toString();
const details =
  {
    type: Office.MailboxEnums.ItemNotificationMessageType.ProgressIndicator,
    message: "Progress indicator with id = " + id
  };
Office.context.mailbox.item.notificationMessages.addAsync(id, details, handleResult);

...

// Adds an informational notification to the mail item.
const id = $("#notificationId").val().toString();
const details =
  {
    type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
    message: "Non-persistent informational notification message with id = " + id,
    icon: "icon1",
    persistent: false
  };
Office.context.mailbox.item.notificationMessages.addAsync(id, details, handleResult);

...

// Adds a persistent information notification to the mail item.
const id = $("#notificationId").val().toString();
const details =
  {
    type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
    message: "Persistent informational notification message with id = " + id,
    icon: "icon1",
    persistent: true
  };
Office.context.mailbox.item.notificationMessages.addAsync(id, details, handleResult);

...

// 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);
});

...

// Replaces a notification message of a given key with another message.
const id = $("#notificationId").val().toString();
Office.context.mailbox.item.notificationMessages.replaceAsync(
  id,
  {
    type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
    message: "Notification message with id = " + id + " has been replaced with an informational message.",
    icon: "icon2",
    persistent: false
  },
  handleResult);

...

// Removes a notification message from the current mail item.
const id = $("#notificationId").val().toString();
Office.context.mailbox.item.notificationMessages.removeAsync(id, handleResult);

optionalAttendees

イベントの任意出席者へのアクセスを提供します。 オブジェクトの種類とアクセス レベルは、現在の項目のモードによって異なります。

プロパティは optionalAttendees 、会議への各省略可能な出席者の EmailAddressDetails オブジェクトを含む配列を返します。 返される出席者の最大数は、Outlook クライアントによって異なります。

  • Windows: 500 人の出席者

  • Android、クラシック Mac UI、iOS: 100 人の出席者

  • 新しい Mac UI、Web ブラウザー: 制限なし

optionalAttendees: EmailAddressDetails[];

プロパティ値

注釈

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

適用される Outlook モード: 予定の出席者

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-optional-attendees-appointment-attendee.yaml

const apptOptionalAttendees = Office.context.mailbox.item.optionalAttendees;
console.log("Optional attendees:");
for (let i = 0; i < apptOptionalAttendees.length; i++) {
  console.log(
    apptOptionalAttendees[i].displayName +
      " (" +
      apptOptionalAttendees[i].emailAddress +
      ") - response: " +
      apptOptionalAttendees[i].appointmentResponse
  );
}

organizer

会議開催者のメール プロパティを取得します。

organizer: EmailAddressDetails;

プロパティ値

注釈

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

適用される Outlook モード: 予定の出席者

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-organizer-appointment-attendee.yaml

const apptOrganizer = Office.context.mailbox.item.organizer;
console.log("Organizer: " + apptOrganizer.displayName + " (" + apptOrganizer.emailAddress + ")");

requiredAttendees

イベントの必須出席者へのアクセスを提供します。 オブジェクトの種類とアクセス レベルは、現在の項目のモードによって異なります。

プロパティは requiredAttendees 、会議に必要な出席者ごとに EmailAddressDetails オブジェクトを含む配列を返します。 返される出席者の最大数は、Outlook クライアントによって異なります。

  • Windows: 500 人の出席者

  • Android、クラシック Mac UI、iOS: 100 人の出席者

  • 新しい Mac UI、Web ブラウザー: 制限なし

requiredAttendees: EmailAddressDetails[];

プロパティ値

注釈

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

適用される Outlook モード: 予定の出席者

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-required-attendees-appointment-attendee.yaml

const apptRequiredAttendees = Office.context.mailbox.item.requiredAttendees;
console.log("Required attendees:");
for (let i = 0; i < apptRequiredAttendees.length; i++) {
  console.log(
    apptRequiredAttendees[i].displayName +
      " (" +
      apptRequiredAttendees[i].emailAddress +
      ") - response: " +
      apptRequiredAttendees[i].appointmentResponse
  );
}

start

予定が開始される日付と時刻を取得します。

startプロパティは、Date協定世界時 (UTC) の日付と時刻の値として表されるオブジェクトです。 メソッドを convertToLocalClientTime 使用して、値をクライアントのローカルの日付と時刻に変換できます。

start: Date;

プロパティ値

Date

注釈

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

適用される Outlook モード: 予定の出席者

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-start-read.yaml

console.log(`Appointment starts: ${Office.context.mailbox.item.start}`);

subject

アイテムの件名フィールドに表示される説明を取得します。

subject プロパティは、電子メール サーバーによって送信されたアイテムの件名全体を取得または設定します。

subject プロパティは文字列を返します。 normalizedSubject RE: や FW: などの先頭のプレフィックスを引いた件名を取得するには、 プロパティを使用します。

subject: string;

プロパティ値

string

注釈

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

適用される Outlook モード: 予定の出席者

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-subject-read.yaml

console.log(`Subject: ${Office.context.mailbox.item.subject}`);

メソッドの詳細

displayReplyAllForm(formData)

選択したメッセージの送信者とすべての受信者、または開催者、および選択した予定のすべての出席者を含む返信フォームを表示します。

displayReplyAllForm(formData: string | ReplyFormData): void;

パラメーター

formData

string | Office.ReplyFormData

回答フォームの本文を表すテキストと HTML が含まれる文字列。 文字列は、本文または添付ファイルのデータとコールバック関数を含む 32 KB または ReplyFormData オブジェクトに制限されています。

戻り値

void

注釈

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

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

適用される Outlook モード: 予定の出席者

重要:

  • Outlook on the webでは、返信フォームは 3 列ビューでポップアップ フォームとして表示され、2 列または 1 列ビューにはポップアップ フォームとして表示されます。

  • 文字列パラメーターのいずれかが制限値を超えると、displayReplyForm は例外をスローします。

  • パラメーターに添付ファイルを formData.attachments 指定すると、Outlook はすべての添付ファイルをダウンロードし、返信フォームに添付しようとします。 添付ファイルの追加に失敗すると、フォーム UI でエラーが表示されます。 表示できない場合、エラー メッセージはスローされません。

  • このメソッドは、Outlook on Android または iOS ではサポートされていません。 Outlook モバイルでサポートされている API の詳細については、「モバイル デバイス上の Outlook でサポートされている Outlook JavaScript API」を参照してください。

// The following code passes a string to the `displayReplyAllForm` method.
Office.context.mailbox.item.displayReplyAllForm('hello there');
Office.context.mailbox.item.displayReplyAllForm('<b>hello there</b>');

// Reply with an empty body.
Office.context.mailbox.item.displayReplyAllForm({});

// Reply with just a body.
Office.context.mailbox.item.displayReplyAllForm(
{
'htmlBody' : 'hi'
});

// Reply with a body and a file attachment.
Office.context.mailbox.item.displayReplyAllForm(
{
    'htmlBody' : 'hi',
    'attachments' :
    [
        {
        'type' : Office.MailboxEnums.AttachmentType.File,
        'name' : 'squirrel.png',
        'url' : 'http://i.imgur.com/sRgTlGR.jpg'
        }
    ]
});

// Reply with a body and an item attachment.
Office.context.mailbox.item.displayReplyAllForm(
{
    'htmlBody' : 'hi',
    'attachments' :
    [
        {
        'type' : 'item',
        'name' : 'rand',
        'itemId' : Office.context.mailbox.item.itemId
        }
    ]
});

// Reply with a body, file attachment, item attachment, and a callback.
Office.context.mailbox.item.displayReplyAllForm(
{
    'htmlBody' : 'hi',
    'attachments' :
    [
        {
            'type' : Office.MailboxEnums.AttachmentType.File,
            'name' : 'squirrel.png',
            'url' : 'http://i.imgur.com/sRgTlGR.jpg'
        },
        {
            'type' : 'item',
            'name' : 'rand',
            'itemId' : Office.context.mailbox.item.itemId
        }
    ],
    'callback' : function(asyncResult)
    {
        console.log(asyncResult.value);
    }
});
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/55-display-items/display-reply-forms.yaml

Office.context.mailbox.item.displayReplyAllForm("This is a reply ALL with <b>some bold text</b>.");

displayReplyForm(formData)

選択したメッセージの送信者のみ、または選択した予定の開催者のみを含む回答フォームが表示されます。

displayReplyForm(formData: string | ReplyFormData): void;

パラメーター

formData

string | Office.ReplyFormData

回答フォームの本文を表すテキストと HTML が含まれる文字列。 文字列は、本文または添付ファイルのデータとコールバック関数を含む 32 KB または ReplyFormData オブジェクトに制限されています。

戻り値

void

注釈

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

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

適用される Outlook モード: 予定の出席者

重要:

  • Outlook on the webでは、返信フォームは 3 列ビューでポップアップ フォームとして表示され、2 列または 1 列ビューにはポップアップ フォームとして表示されます。

  • 文字列パラメーターのいずれかが制限値を超えると、displayReplyForm は例外をスローします。

  • パラメーターに添付ファイルを formData.attachments 指定すると、Outlook はすべての添付ファイルをダウンロードし、返信フォームに添付しようとします。 添付ファイルの追加に失敗すると、フォーム UI でエラーが表示されます。 表示できない場合、エラー メッセージはスローされません。

  • このメソッドは、Outlook on Android または iOS ではサポートされていません。 Outlook モバイルでサポートされている API の詳細については、「モバイル デバイス上の Outlook でサポートされている Outlook JavaScript API」を参照してください。

// The following code passes a string to the `displayReplyForm` method.
Office.context.mailbox.item.displayReplyForm('hello there');
Office.context.mailbox.item.displayReplyForm('<b>hello there</b>');

// Reply with an empty body.
Office.context.mailbox.item.displayReplyForm({});

// Reply with just a body.
Office.context.mailbox.item.displayReplyForm(
{
    'htmlBody' : 'hi'
});

// Reply with a body and a file attachment.
Office.context.mailbox.item.displayReplyForm(
{
    'htmlBody' : 'hi',
    'attachments' :
    [
        {
            'type' : Office.MailboxEnums.AttachmentType.File,
            'name' : 'squirrel.png',
            'url' : 'http://i.imgur.com/sRgTlGR.jpg'
        }
    ]
});

// Reply with a body and an item attachment.
Office.context.mailbox.item.displayReplyForm(
{
    'htmlBody' : 'hi',
    'attachments' :
    [
        {
            'type' : 'item',
            'name' : 'rand',
            'itemId' : Office.context.mailbox.item.itemId
        }
    ]
});

// Reply with a body, file attachment, item attachment, and a callback.
Office.context.mailbox.item.displayReplyForm(
{
    'htmlBody' : 'hi',
    'attachments' :
    [
        {
            'type' : Office.MailboxEnums.AttachmentType.File,
            'name' : 'squirrel.png',
            'url' : 'http://i.imgur.com/sRgTlGR.jpg'
        },
        {
            'type' : 'item',
            'name' : 'rand',
            'itemId' : Office.context.mailbox.item.itemId
        }
    ],
    'callback' : function(asyncResult)
    {
        console.log(asyncResult.value);
    }
});
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/55-display-items/display-reply-forms.yaml

Office.context.mailbox.item.displayReplyForm("This is a reply with <i>some text in italics</i>.");

...

Office.context.mailbox.item.displayReplyForm({
  htmlBody: "This is a reply with a couple of attachments - an inline image and an item<br><img src='cid:dog.jpg'>",
  attachments: [
    { type: "file", url: "http://i.imgur.com/9S36xvA.jpg", name: "dog.jpg", isInline: true },
    { type: "item", itemId: Office.context.mailbox.item.itemId, name: "test_email.msg" }
  ],
  options: { asyncContext: null },
  callback: function(result) {
    if (result.status !== Office.AsyncResultStatus.Succeeded) {
      console.error(`Action failed with message ${result.error.message}`);
    }
  }
});

getEntities()

選択したアイテムの本文にあるエンティティを取得します。

getEntities(): Entities;

戻り値

注釈

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

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

適用される Outlook モード: 予定の出席者

重要:

  • メソッドを含む getEntities エンティティベースのコンテキスト Outlook アドインは、2024 年第 2 四半期に廃止される予定です。 このメソッドを廃止する作業は 5 月に開始され、6 月末まで続行されます。 6 月以降、コンテキスト アドインはメール アイテム内のエンティティを検出してタスクを実行できなくなります。 エンティティ ベースのコンテキスト アドインが廃止された後も、正規表現ルールは引き続きサポートされます。 代替ソリューションとして正規表現ルールを使用するように、コンテキスト アドインを更新することをお勧めします。 これらのルールを実装する方法のガイダンスについては、「 正規表現アクティブ化ルールを使用して Outlook アドインを表示する」を参照してください。 エンティティベースのコンテキスト Outlook アドインの廃止の詳細については、「 エンティティベースのコンテキスト Outlook アドインの廃止」を参照してください。

  • このメソッドは、Outlook on Android または iOS ではサポートされていません。 Outlook モバイルでサポートされている API の詳細については、「モバイル デバイス上の Outlook でサポートされている Outlook JavaScript API」を参照してください。

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/75-entities-and-regex-matches/basic-entities.yaml

const entities = Office.context.mailbox.item.getEntities();
let entityTypesFound = 0;
if (entities.addresses.length > 0) {
    console.warn("physical addresses: ");
    console.log(entities.addresses);
    entityTypesFound++;
}
if (entities.contacts.length > 0) {
    console.warn("contacts: ");
    entities.contacts.forEach(function (contact) { console.log(contact.personName); })
    entityTypesFound++;
}
if (entities.emailAddresses.length > 0) {
    console.warn("email addresses: ");
    console.log(entities.emailAddresses);
    entityTypesFound++;
}
if (entities.meetingSuggestions.length > 0) {
    console.warn("meetings suggestions: ");
    entities.meetingSuggestions.forEach(function (meetingSuggestion) { console.log(meetingSuggestion.meetingString); })
    entityTypesFound++;
}
if (entities.phoneNumbers.length > 0) {
    console.warn("phone numbers: ");
    entities.phoneNumbers.forEach(function (phoneNumber) { console.log(phoneNumber.originalPhoneString); })
    entityTypesFound++;
}
if (entities.taskSuggestions.length > 0) {
    console.warn("task suggestions: ");
    entities.taskSuggestions.forEach(function (taskSuggestion) { console.log(taskSuggestion.taskString); })
    entityTypesFound++;
}
if (entities.urls.length > 0) {
    console.warn("URLs: ");
    console.log(entities.urls);
    entityTypesFound++;
}
if (entityTypesFound == 0)
{
    console.log("No entities found on this item.");
}

getEntitiesByType(entityType)

選択したアイテムの本文内で検出された指定のエンティティ型のすべてのエンティティを含む配列を取得します。

getEntitiesByType(entityType: MailboxEnums.EntityType | string): Array<string | Contact | MeetingSuggestion | PhoneNumber | TaskSuggestion>;

パラメーター

entityType

Office.MailboxEnums.EntityType | string

列挙値の EntityType 1 つ。

このメソッドを使用するための最小アクセス許可レベルは 制限されていますが、一部のエンティティ型では、次の表で指定されているように、アクセスするために 読み取り項目 が必要です。

entityType の値 返される配列内のオブジェクトの型 必要なアクセス許可のレベル
Address String Restricted
Contact Contact ReadItem
EmailAddress String ReadItem
MeetingSuggestion MeetingSuggestion ReadItem
PhoneNumber PhoneNumber Restricted
TaskSuggestion TaskSuggestion ReadItem
URL String Restricted

戻り値

entityType に渡された値が EntityType 列挙型の有効なメンバーでない場合、メソッドは null を返します。 指定した型のエンティティがアイテムの本文に存在しない場合、メソッドは空の配列を返します。 それ以外の場合は、返される配列内のオブジェクトの型は、entityType パラメーター内の要求されたエンティティの型によって異なります。

注釈

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

最小アクセス許可レベル: 制限

適用される Outlook モード: 予定の出席者

重要:

  • メソッドを含む getEntitiesByType エンティティベースのコンテキスト Outlook アドインは、2024 年第 2 四半期に廃止される予定です。 このメソッドを廃止する作業は 5 月に開始され、6 月末まで続行されます。 6 月以降、コンテキスト アドインはメール アイテム内のエンティティを検出してタスクを実行できなくなります。 エンティティ ベースのコンテキスト アドインが廃止された後も、正規表現ルールは引き続きサポートされます。 代替ソリューションとして正規表現ルールを使用するように、コンテキスト アドインを更新することをお勧めします。 これらのルールを実装する方法のガイダンスについては、「 正規表現アクティブ化ルールを使用して Outlook アドインを表示する」を参照してください。 エンティティベースのコンテキスト Outlook アドインの廃止の詳細については、「 エンティティベースのコンテキスト Outlook アドインの廃止」を参照してください。

  • このメソッドは、Outlook on Android または iOS ではサポートされていません。 Outlook モバイルでサポートされている API の詳細については、「モバイル デバイス上の Outlook でサポートされている Outlook JavaScript API」を参照してください。

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/75-entities-and-regex-matches/basic-entities.yaml

console.log(Office.context.mailbox.item.getEntitiesByType(Office.MailboxEnums.EntityType.Address));

getFilteredEntitiesByName(name)

XML マニフェスト ファイルで定義されている名前付きフィルターを渡す、選択した項目の既知のエンティティを返します。

getFilteredEntitiesByName(name: string): Array<string | Contact | MeetingSuggestion | PhoneNumber | TaskSuggestion>;

パラメーター

name

string

一致するフィルターを定義する ItemHasKnownEntity ルール要素の名前。

戻り値

マニフェスト XML ファイル内の rule 要素で ItemHasKnownEntity 定義されている正規表現と、指定した FilterName 要素値と一致するエンティティ。 パラメーターに一致nameする要素値を持つFilterName要素がマニフェストに存在しないItemHasKnownEntity場合、メソッドは を返しますnull。 パラメーターがマニフェスト内の name 要素と ItemHasKnownEntity 一致するが、現在のアイテムに一致するエンティティがない場合、メソッドは空の配列を返します。

注釈

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

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

適用される Outlook モード: 予定の出席者

重要:

  • メソッドを含む getFilteredEntitiesByName エンティティベースのコンテキスト Outlook アドインは、2024 年第 2 四半期に廃止される予定です。 このメソッドを廃止する作業は 5 月に開始され、6 月末まで続行されます。 6 月以降、コンテキスト アドインはメール アイテム内のエンティティを検出してタスクを実行できなくなります。 エンティティ ベースのコンテキスト アドインが廃止された後も、正規表現ルールは引き続きサポートされます。 代替ソリューションとして正規表現ルールを使用するように、コンテキスト アドインを更新することをお勧めします。 これらのルールを実装する方法のガイダンスについては、「 正規表現アクティブ化ルールを使用して Outlook アドインを表示する」を参照してください。 エンティティベースのコンテキスト Outlook アドインの廃止の詳細については、「 エンティティベースのコンテキスト Outlook アドインの廃止」を参照してください。

  • このメソッドは、 Outlook アドインのライセンス認証ルール機能で使用されます。これは、 Microsoft 365 の統合マニフェストではサポートされていません。

  • このメソッドは、Outlook on Android または iOS ではサポートされていません。 Outlook モバイルでサポートされている API の詳細については、「モバイル デバイス上の Outlook でサポートされている Outlook JavaScript API」を参照してください。

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/75-entities-and-regex-matches/contextual.yaml

// This API would only work when you click on highlighted physical address that has the word "Way" in it.
console.log(Office.context.mailbox.item.getFilteredEntitiesByName("sampleFilterName"));

getRegExMatches()

XML マニフェスト ファイルで定義されている正規表現に一致する、選択した項目の文字列値を返します。

getRegExMatches(): any;

戻り値

any

マニフェスト XML ファイルで定義された正規表現に一致する文字列の配列が格納されたオブジェクト。 各配列の名前は、一致するルールの RegExName 属性の対応する値、またはFilterName照合ItemHasRegularExpressionMatchルールのItemHasKnownEntity属性と等しくなります。 ルールの ItemHasRegularExpressionMatch 場合、一致する文字列は、そのルールによって指定されたアイテムのプロパティで発生する必要があります。 単純型は、サポートされるプロパティを定義します。

注釈

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

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

適用される Outlook モード: 予定の出席者

重要:

  • エンティティベースのコンテキスト Outlook アドインは、2024 年第 2 四半期に廃止される予定です。 廃止されると、コンテキスト アドインはメール アイテム内のエンティティを検出してタスクを実行できなくなります。 エンティティ ベースのコンテキスト アドインが廃止された後も、正規表現ルールは引き続きサポートされます。 代替ソリューションとして正規表現ルールを使用するように、コンテキスト アドインを更新することをお勧めします。 これらのルールを実装する方法のガイダンスについては、「 正規表現アクティブ化ルールを使用して Outlook アドインを表示する」を参照してください。 エンティティベースのコンテキスト アドインの廃止の詳細については、「 エンティティベースのコンテキスト Outlook アドインの廃止」を参照してください。

  • このメソッドは、 Outlook アドインのライセンス認証ルール機能で使用されます。これは、 Microsoft 365 の統合マニフェストではサポートされていません。

  • アイテムの body プロパティにルールを ItemHasRegularExpressionMatch 指定した場合、正規表現は本文をさらにフィルター処理し、アイテムの本文全体を返そうとしないでください。 などの .* 正規表現を使用してアイテムの本文全体を取得しても、常に期待される結果が返されるとは限りません。 この場合、代わりに Body.getAsync メソッドを使用して本文全体を取得します。

  • このメソッドは、Outlook on Android または iOS ではサポートされていません。 Outlook モバイルでサポートされている API の詳細については、「モバイル デバイス上の Outlook でサポートされている Outlook JavaScript API」を参照してください。

// Consider an add-in manifest has the following `Rule` element:
//<Rule xsi:type="RuleCollection" Mode="And">
//  <Rule xsi:type="ItemIs" FormType="Read" ItemType="Message" />
//  <Rule xsi:type="RuleCollection" Mode="Or">
//    <Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="fruits" RegExValue="apple|banana|coconut" PropertyName="BodyAsPlaintext" IgnoreCase="true" />
//    <Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="veggies" RegExValue="tomato|onion|spinach|broccoli" PropertyName="BodyAsPlaintext" IgnoreCase="true" />
//  </Rule>
//</Rule>

// The object returned from `getRegExMatches` would have two properties: `fruits` and `veggies`.
//{
//'fruits': ['apple','banana','Banana','coconut'],
//'veggies': ['tomato','onion','spinach','broccoli']
//}

// The following example shows how to access the array of
// matches for the regular expression rule elements `fruits`
// and `veggies`, which are specified in the manifest.
const allMatches = Office.context.mailbox.item.getRegExMatches();
const fruits = allMatches.fruits;
const veggies = allMatches.veggies;
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/75-entities-and-regex-matches/contextual.yaml

// This API would only work when you click on highlighted word "ScriptLab".
console.log(Office.context.mailbox.item.getRegExMatches());

getRegExMatchesByName(name)

XML マニフェスト ファイルで定義されている名前付き正規表現と一致する、選択した項目の文字列値を返します。

getRegExMatchesByName(name: string): string[];

パラメーター

name

string

一致するフィルターを定義する ItemHasRegularExpressionMatch ルール要素の名前。

戻り値

string[]

マニフェスト XML ファイル内の rule 要素で ItemHasRegularExpressionMatch 定義されている正規表現に一致する文字列と、指定した RegExName 要素値を含む配列。

注釈

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

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

適用される Outlook モード: 予定の出席者

重要:

  • エンティティベースのコンテキスト Outlook アドインは、2024 年第 2 四半期に廃止される予定です。 廃止されると、コンテキスト アドインはメール アイテム内のエンティティを検出してタスクを実行できなくなります。 エンティティ ベースのコンテキスト アドインが廃止された後も、正規表現ルールは引き続きサポートされます。 代替ソリューションとして正規表現ルールを使用するように、コンテキスト アドインを更新することをお勧めします。 これらのルールを実装する方法のガイダンスについては、「 正規表現アクティブ化ルールを使用して Outlook アドインを表示する」を参照してください。 エンティティベースのコンテキスト アドインの廃止の詳細については、「 エンティティベースのコンテキスト Outlook アドインの廃止」を参照してください。

  • このメソッドは、 Outlook アドインのライセンス認証ルール機能で使用されます。これは、 Microsoft 365 の統合マニフェストではサポートされていません。

  • アイテムの body プロパティにルールを ItemHasRegularExpressionMatch 指定した場合、正規表現は本文をさらにフィルター処理し、アイテムの本文全体を返そうとしないでください。 などの .* 正規表現を使用してアイテムの本文全体を取得しても、常に期待される結果が返されるとは限りません。 この場合、代わりに Body.getAsync メソッドを使用して本文全体を取得します。

  • このメソッドは、Outlook on Android または iOS ではサポートされていません。 Outlook モバイルでサポートされている API の詳細については、「モバイル デバイス上の Outlook でサポートされている Outlook JavaScript API」を参照してください。

// Consider an add-in manifest has the following `Rule` element:
//<Rule xsi:type="RuleCollection" Mode="And">
//  <Rule xsi:type="ItemIs" FormType="Read" ItemType="Message" />
//  <Rule xsi:type="RuleCollection" Mode="Or">
//    <Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="fruits" RegExValue="apple|banana|coconut" PropertyName="BodyAsPlaintext" IgnoreCase="true" />
//    <Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="veggies" RegExValue="tomato|onion|spinach|broccoli" PropertyName="BodyAsPlaintext" IgnoreCase="true" />
//  </Rule>
//</Rule>

// The object returned from `getRegExMatches` would have two properties: `fruits` and `veggies`.
//{
//'fruits': ['apple','banana','Banana','coconut'],
//'veggies': ['tomato','onion','spinach','broccoli']
//}

const fruits = Office.context.mailbox.item.getRegExMatchesByName("fruits");
const veggies = Office.context.mailbox.item.getRegExMatchesByName("veggies");
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/75-entities-and-regex-matches/contextual.yaml

// This API would only work when you click on highlighted word "ScriptLab".
console.log(Office.context.mailbox.item.getRegExMatchesByName("sampleRegexName"));

getSelectedEntities()

強調表示された一致内で見つかったユーザーが選択しているエンティティを取得します。 強調表示された一致は、コンテキスト アドインに適用されます。

getSelectedEntities(): Entities;

戻り値

注釈

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

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

適用される Outlook モード: 予定の出席者

重要:

  • メソッドを含む getSelectedEntities エンティティベースのコンテキスト Outlook アドインは、2024 年第 2 四半期に廃止される予定です。 このメソッドを廃止する作業は 5 月に開始され、6 月末まで続行されます。 6 月以降、コンテキスト アドインはメール アイテム内のエンティティを検出してタスクを実行できなくなります。 エンティティ ベースのコンテキスト アドインが廃止された後も、正規表現ルールは引き続きサポートされます。 代替ソリューションとして正規表現ルールを使用するように、コンテキスト アドインを更新することをお勧めします。 これらのルールを実装する方法のガイダンスについては、「 正規表現アクティブ化ルールを使用して Outlook アドインを表示する」を参照してください。 エンティティベースのコンテキスト Outlook アドインの廃止の詳細については、「 エンティティベースのコンテキスト Outlook アドインの廃止」を参照してください。

  • このメソッドは、 Outlook アドインのライセンス認証ルール機能で使用されます。これは、 Microsoft 365 の統合マニフェストではサポートされていません。

  • このメソッドは、Outlook on iOS または Android ではサポートされていません。 Outlook モバイルでサポートされている API の詳細については、「モバイル デバイス上の Outlook でサポートされている Outlook JavaScript API」を参照してください。

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/75-entities-and-regex-matches/selected.yaml

const entities = Office.context.mailbox.item.getSelectedEntities();
let entityTypesFound = 0;
if (entities.addresses.length > 0) {
    console.warn("physical addresses: ");
    console.log(entities.addresses);
    entityTypesFound++;
}
if (entities.contacts.length > 0) {
    console.warn("contacts: ");
    entities.contacts.forEach(function (contact) { console.log(contact.personName); })
    entityTypesFound++;
}
if (entities.emailAddresses.length > 0) {
    console.warn("email addresses: ");
    console.log(entities.emailAddresses);
    entityTypesFound++;
}
if (entities.meetingSuggestions.length > 0) {
    console.warn("meetings suggestions: ");
    entities.meetingSuggestions.forEach(function (meetingSuggestion) { console.log(meetingSuggestion.meetingString); })
    entityTypesFound++;
}
if (entities.phoneNumbers.length > 0) {
    console.warn("phone numbers: ");
    entities.phoneNumbers.forEach(function (phoneNumber) { console.log(phoneNumber.originalPhoneString); })
    entityTypesFound++;
}
if (entities.taskSuggestions.length > 0) {
    console.warn("task suggestions: ");
    entities.taskSuggestions.forEach(function (taskSuggestion) { console.log(taskSuggestion.taskString); })
    entityTypesFound++;
}
if (entities.urls.length > 0) {
    console.warn("URLs: ");
    console.log(entities.urls);
    entityTypesFound++;
}
if (entityTypesFound == 0)
{
    console.error("Open add-in by clicking on a highlighted entity, for this API to return something useful.");
}

getSelectedRegExMatches()

XML マニフェスト ファイルで定義されている正規表現と一致する強調表示された一致の文字列値を返します。 強調表示された一致は、コンテキスト アドインに適用されます。

getSelectedRegExMatches(): any;

戻り値

any

マニフェスト XML ファイルで定義された正規表現に一致する文字列の配列が格納されたオブジェクト。 各配列の名前は、一致する RegExName ルールの ItemHasRegularExpressionMatch 属性、または一致する FilterName ルールの ItemHasKnownEntity 属性の対応する値と等しくなります。 ルールの場合、そのルールで指定されたアイテムのプロパティに一致する文字列が発生する必要があります。ItemHasRegularExpressionMatch 単純型は、サポートされるプロパティを定義します。

注釈

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

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

適用される Outlook モード: 予定の出席者

重要:

  • エンティティベースのコンテキスト Outlook アドインは、2024 年第 2 四半期に廃止される予定です。 廃止されると、コンテキスト アドインはメール アイテム内のエンティティを検出してタスクを実行できなくなります。 エンティティ ベースのコンテキスト アドインが廃止された後も、正規表現ルールは引き続きサポートされます。 代替ソリューションとして正規表現ルールを使用するように、コンテキスト アドインを更新することをお勧めします。 これらのルールを実装する方法のガイダンスについては、「 正規表現アクティブ化ルールを使用して Outlook アドインを表示する」を参照してください。 エンティティベースのコンテキスト アドインの廃止の詳細については、「 エンティティベースのコンテキスト Outlook アドインの廃止」を参照してください。

  • このメソッドは、 Outlook アドインのライセンス認証ルール機能で使用されます。これは、 Microsoft 365 の統合マニフェストではサポートされていません。

  • このメソッドは、Outlook on iOS または Android ではサポートされていません。 Outlook モバイルでサポートされている API の詳細については、「モバイル デバイス上の Outlook でサポートされている Outlook JavaScript API」を参照してください。

  • アイテムの body プロパティにルールを ItemHasRegularExpressionMatch 指定した場合、正規表現は本文をさらにフィルター処理し、アイテムの本文全体を返そうとしないでください。 .* などの正規表現を使用してアイテムの本文全体を取得しても、常に期待される結果が返されるとは限りません。 この場合、代わりに Body.getAsync メソッドを使用して本文全体を取得します。

// Consider an add-in manifest has the following `Rule` element:
//<Rule xsi:type="RuleCollection" Mode="And">
//  <Rule xsi:type="ItemIs" FormType="Read" ItemType="Message" />
//  <Rule xsi:type="RuleCollection" Mode="Or">
//    <Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="fruits" RegExValue="apple|banana|coconut" PropertyName="BodyAsPlaintext" IgnoreCase="true" />
//    <Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="veggies" RegExValue="tomato|onion|spinach|broccoli" PropertyName="BodyAsPlaintext" IgnoreCase="true" />
//  </Rule>
//</Rule>

// The object returned from `getRegExMatches` would have two properties: `fruits` and `veggies`.
//{
//'fruits': ['apple','banana','Banana','coconut'],
//'veggies': ['tomato','onion','spinach','broccoli']
//}

// The following example shows how to access the array of matches for the
// regular expression rule elements `fruits` and `veggies`, which are
// specified in the manifest.
const selectedMatches = Office.context.mailbox.item.getSelectedRegExMatches();
const fruits = selectedMatches.fruits;
const veggies = selectedMatches.veggies;
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/75-entities-and-regex-matches/selected.yaml

const matches = Office.context.mailbox.item.getSelectedRegExMatches();
if (matches) {
    console.log(matches);
}
else {
    console.error("Open add-in by clicking on a highlighted regex match, for this API to return something useful.");
}

loadCustomPropertiesAsync(callback, userContext)

選択されたアイテムのこのアドインのカスタム プロパティを非同期に読み込みます。

カスタム プロパティは、アプリごとに項目ごとにキーと値のペアとして格納されます。 このメソッドはコールバックで CustomProperties オブジェクトを返します。これにより、現在のアイテムと現在のアドインに固有のカスタム プロパティにアクセスするメソッドが提供されます。 カスタム プロパティはアイテムで暗号化されないため、セキュリティで保護されたストレージとして使用しないでください。

カスタム プロパティは asyncResult.value プロパティの CustomProperties オブジェクトとして指定されます。 このオブジェクトを使用して、メール アイテムのカスタム プロパティを取得、設定、保存、および削除できます。

loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult<CustomProperties>) => void, userContext?: any): void;

パラメーター

callback

(asyncResult: Office.AsyncResult<Office.CustomProperties>) => void

メソッドが完了すると、 パラメーターで callback 渡された関数が、 型 Office.AsyncResultの 1 つのパラメーターで呼び出されます。

userContext

any

省略可能。 開発者は、コールバック関数でアクセスする任意のオブジェクトを指定できます。 このオブジェクトには、コールバック関数の asyncResult.asyncContext プロパティによってアクセスすることができます。

戻り値

void

注釈

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

カスタム プロパティの詳細については、「Outlook アドインのアドイン メタデータを取得して設定する」を参照してください。

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

適用される Outlook モード: 予定の出席者

// The following example shows how to use the loadCustomPropertiesAsync method
// to asynchronously load custom properties that are specific to the current item.
// The example also shows how to use the saveAsync method to save these properties
// back to the server. After loading the custom properties, the example uses the
// get method to read the custom property myProp, the set method to write the
// custom property otherProp, and then finally calls the saveAsync method to save
// the custom properties.
Office.initialize = function () {
    // Checks for the DOM to load using the jQuery ready method.
    $(document).ready(function () {
        // After the DOM is loaded, add-in-specific code can run.
        const mailbox = Office.context.mailbox;
        mailbox.item.loadCustomPropertiesAsync(customPropsCallback);
    });
};

function customPropsCallback(asyncResult) {
    const customProps = asyncResult.value;
    const myProp = customProps.get("myProp");

    customProps.set("otherProp", "value");
    customProps.saveAsync(saveCallback);
}

function saveCallback(asyncResult) {
}
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/15-item-custom-properties/load-set-get-save.yaml

Office.context.mailbox.item.loadCustomPropertiesAsync(function (result) {
  if (result.status === Office.AsyncResultStatus.Succeeded) {
    console.log("Loaded following custom properties:");
    customProps = result.value;
    const dataKey = Object.keys(customProps)[0];
    const data = customProps[dataKey];
    for (let propertyName in data)
    {
      let propertyValue = data[propertyName];
      console.log(`${propertyName}: ${propertyValue}`);
    }              
  }
  else {
    console.error(`loadCustomPropertiesAsync failed with message ${result.error.message}`);
  }
});