Office.AppointmentCompose interface
Office.context.mailbox.item の予定開催者モード。
重要: これは内部 Outlook オブジェクトであり、既存のインターフェイスを介して直接公開されることはありません。 これは のモード Office.context.mailbox.item
として扱う必要があります。 詳細については、「 オブジェクト モデル 」ページを参照してください。
親インターフェイス:
- Extends
プロパティ
body | アイテムの本文を操作するメソッドを提供するオブジェクトを取得します。 |
end | 予定が終了する日時を取得または設定します。 プロパティは
重要: Windows クライアントでは、このプロパティを使用して繰り返しの終了を更新することはできません。 |
item |
インスタンスが表しているアイテムの種類を取得します。
|
location | 予定の場所を取得または設定します。 プロパティは |
optional |
イベントの任意出席者へのアクセスを提供します。 オブジェクトの種類とアクセス レベルは、現在の項目のモードによって異なります。
|
required |
イベントの必須出席者へのアクセスを提供します。 オブジェクトの種類とアクセス レベルは、現在の項目のモードによって異なります。
|
start | 予定を開始する日時を取得または設定します。 プロパティは
重要: Windows クライアントでは、このプロパティを使用して繰り返しの開始を更新することはできません。 |
subject | アイテムの件名フィールドに示される説明を取得または設定します。
|
メソッド
add |
ファイルを添付ファイルとしてメッセージまたは予定に追加します。
その後、 重要: Windows 上の Outlook の最近のビルドでは、ヘッダーを誤ってこのアクションに追加 |
add |
ファイルを添付ファイルとしてメッセージまたは予定に追加します。
その後、 重要: Windows 上の Outlook の最近のビルドでは、ヘッダーを誤ってこのアクションに追加 |
add |
メッセージなどの Exchange アイテムを添付ファイルとして、メッセージまたは予定に追加します。 メソッドは その後、 Office アドインを Outlook on the web で実行している場合、編集中のアイテム以外のアイテムに |
add |
メッセージなどの Exchange アイテムを添付ファイルとして、メッセージまたは予定に追加します。 メソッドは その後、 Office アドインを Outlook on the web で実行している場合、編集中のアイテム以外のアイテムに |
load |
選択されたアイテムのこのアドインのカスタム プロパティを非同期に読み込みます。 カスタム プロパティは、アプリごとに項目ごとにキーと値のペアとして格納されます。 このメソッドはコールバックで CustomProperties オブジェクトを返します。これにより、現在のアイテムと現在のアドインに固有のカスタム プロパティにアクセスするメソッドが提供されます。 カスタム プロパティはアイテムで暗号化されないため、セキュリティで保護されたストレージとして使用しないでください。 カスタム プロパティは |
remove |
メッセージまたは予定から添付ファイルを削除します。
|
remove |
メッセージまたは予定から添付ファイルを削除します。
|
プロパティの詳細
body
アイテムの本文を操作するメソッドを提供するオブジェクトを取得します。
body: Body;
プロパティ値
注釈
最小アクセス許可レベル: アイテムの読み取り
適用される 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 an object that is passed as the result parameter to the callback function.
{
"value": "TEXT of whole body (including threads below)",
"status": "succeeded",
"asyncContext": "This is passed to the callback"
}
end
予定が終了する日時を取得または設定します。
プロパティは end
、協定世界時 (UTC) の日付と時刻の値として表される Time オブジェクトです。 メソッドを convertToLocalClientTime
使用して、プロパティ値を end
クライアントのローカルの日付と時刻に変換できます。
Time.setAsync
メソッドを使用して終了時刻を設定する場合、convertToUtcClientTime
メソッドを使用して、クライアント上のローカルの時刻をサーバーの UTC に変換する必要があります。
重要: Windows クライアントでは、このプロパティを使用して繰り返しの終了を更新することはできません。
end: Time;
プロパティ値
注釈
最小アクセス許可レベル: アイテムの読み取り
適用される Outlook モード: 予定オーガナイザー
例
// The following example sets the end time of an appointment in compose mode by
// using the `setAsync` method of the `Time` object.
const endTime = new Date("3/14/2015");
const options = {
// Pass information that can be used in the callback.
asyncContext: {verb: "Set"}
};
Office.context.mailbox.item.end.setAsync(endTime, options, function(result) {
if (result.error) {
console.debug(result.error);
} else {
// Access the asyncContext that was passed to the setAsync method.
console.debug("End Time " + result.asyncContext.verb);
}
});
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-set-end-appointment-organizer.yaml
Office.context.mailbox.item.end.getAsync((result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Action failed with message ${result.error.message}`);
return;
}
console.log(`Appointment ends: ${result.value}`);
});
...
Office.context.mailbox.item.start.getAsync((result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Get start date failed with message ${result.error.message}`);
return;
}
const end = result.value; // Set end to current start date and time.
end.setDate(end.getDate() + 1); // Set end as 1 day later than start date.
Office.context.mailbox.item.end.setAsync(end, (result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Set end date failed with message ${result.error.message}`);
return;
}
console.log(`Successfully set end date and time to ${end}`);
});
});
itemType
インスタンスが表しているアイテムの種類を取得します。
itemType
プロパティは、ItemType
列挙値の 1 つを返します。これは item
オブジェクト インスタンスがメッセージと予定のどちらであるかを示すものです。
itemType: MailboxEnums.ItemType | string;
プロパティ値
Office.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 オブジェクトを返します。
location: Location;
プロパティ値
注釈
最小アクセス許可レベル: アイテムの読み取り
適用される Outlook モード: 予定オーガナイザー
例
const userContext = { value : 1 };
Office.context.mailbox.item.location.getAsync( { context: userContext}, callback);
function callback(asyncResult) {
const context = asyncResult.context;
const location = asyncResult.value;
}
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-set-location-appointment-organizer.yaml
Office.context.mailbox.item.location.getAsync((result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Action failed with message ${result.error.message}`);
return;
}
console.log(`Appointment location: ${result.value}`);
});
...
const location = "my office";
Office.context.mailbox.item.location.setAsync(location, (result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Action failed with message ${result.error.message}`);
return;
}
console.log(`Successfully set location to ${location}`);
});
optionalAttendees
イベントの任意出席者へのアクセスを提供します。 オブジェクトの種類とアクセス レベルは、現在の項目のモードによって異なります。
optionalAttendees
プロパティは会議への任意出席者を取得または更新するためのメソッドを提供する Recipients
オブジェクトを返します。 ただし、クライアント/プラットフォーム (Windows、Mac など) によっては、取得または更新できる受信者の数に制限が適用される場合があります。 詳細については、 Recipients オブジェクトを参照してください。
optionalAttendees: Recipients;
プロパティ値
注釈
最小アクセス許可レベル: アイテムの読み取り
適用される Outlook モード: 予定オーガナイザー
例
Office.context.mailbox.item.optionalAttendees.setAsync( ['alice@contoso.com', 'bob@contoso.com'] );
Office.context.mailbox.item.optionalAttendees.addAsync( ['jason@contoso.com'] );
Office.context.mailbox.item.optionalAttendees.getAsync(callback);
function callback(asyncResult) {
const arrayOfOptionalAttendeesRecipients = asyncResult.value;
}
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-set-optional-attendees-appointment-organizer.yaml
Office.context.mailbox.item.optionalAttendees.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const apptOptionalAttendees = asyncResult.value;
for (let i = 0; i < apptOptionalAttendees.length; i++) {
console.log(
"Optional attendees: " +
apptOptionalAttendees[i].displayName +
" (" +
apptOptionalAttendees[i].emailAddress +
") - response: " +
apptOptionalAttendees[i].appointmentResponse
);
}
} else {
console.error(asyncResult.error);
}
});
...
const email = $("#emailOptional")
.val()
.toString();
const emailArray = [email];
Office.context.mailbox.item.optionalAttendees.setAsync(emailArray, function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log("Succeeded in setting optional attendees field.");
} else {
console.error(asyncResult.error);
}
});
requiredAttendees
イベントの必須出席者へのアクセスを提供します。 オブジェクトの種類とアクセス レベルは、現在の項目のモードによって異なります。
requiredAttendees
プロパティは会議への必須出席者を取得または更新するためのメソッドを提供する Recipients
オブジェクトを返します。 ただし、クライアント/プラットフォーム (Windows、Mac など) によっては、取得または更新できる受信者の数に制限が適用される場合があります。 詳細については、 Recipients オブジェクトを参照してください。
requiredAttendees: Recipients;
プロパティ値
注釈
最小アクセス許可レベル: アイテムの読み取り
適用される Outlook モード: 予定オーガナイザー
例
Office.context.mailbox.item.requiredAttendees.setAsync( ['alice@contoso.com', 'bob@contoso.com'] );
Office.context.mailbox.item.requiredAttendees.addAsync( ['jason@contoso.com'] );
Office.context.mailbox.item.requiredAttendees.getAsync(callback);
function callback(asyncResult) {
const arrayOfRequiredAttendeesRecipients = asyncResult.value;
console.log(JSON.stringify(arrayOfRequiredAttendeesRecipients));
}
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-set-required-attendees-appointment-organizer.yaml
Office.context.mailbox.item.requiredAttendees.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const apptRequiredAttendees = asyncResult.value;
for (let i = 0; i < apptRequiredAttendees.length; i++) {
console.log(
"Required attendees: " +
apptRequiredAttendees[i].displayName +
" (" +
apptRequiredAttendees[i].emailAddress +
") - response: " +
apptRequiredAttendees[i].appointmentResponse
);
}
} else {
console.error(asyncResult.error);
}
});
...
const email = $("#emailRequired")
.val()
.toString();
const emailArray = [email];
Office.context.mailbox.item.requiredAttendees.setAsync(emailArray, function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log("Succeeded in setting required attendees field.");
} else {
console.error(asyncResult.error);
}
});
start
予定を開始する日時を取得または設定します。
プロパティは start
、協定世界時 (UTC) の日付と時刻の値として表される Time オブジェクトです。 メソッドを convertToLocalClientTime
使用して、値をクライアントのローカルの日付と時刻に変換できます。
Time.setAsync
メソッドを使用して開始時刻を設定する場合、convertToUtcClientTime
メソッドを使用して、クライアント上のローカルの時刻をサーバーの UTC に変換する必要があります。
重要: Windows クライアントでは、このプロパティを使用して繰り返しの開始を更新することはできません。
start: Time;
プロパティ値
注釈
最小アクセス許可レベル: アイテムの読み取り
適用される Outlook モード: 予定オーガナイザー
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-set-start-appointment-organizer.yaml
Office.context.mailbox.item.start.getAsync((result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Action failed with message ${result.error.message}`);
return;
}
console.log(`Appointment starts: ${result.value}`);
});
...
const start = new Date(); // Represents current date and time.
start.setDate(start.getDate() + 2); // Add 2 days to current date.
Office.context.mailbox.item.start.setAsync(start, (result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Action failed with message ${result.error.message}`);
return;
}
console.log(`Successfully set start date and time to ${start}`);
});
subject
アイテムの件名フィールドに示される説明を取得または設定します。
subject
プロパティは、電子メール サーバーによって送信されたアイテムの件名全体を取得または設定します。
subject
プロパティは件名を取得および設定するためのメソッドを提供する Subject
オブジェクトを返します。
subject: Subject;
プロパティ値
注釈
最小アクセス許可レベル: アイテムの読み取り
適用される Outlook モード: 予定オーガナイザー
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-set-subject-compose.yaml
Office.context.mailbox.item.subject.getAsync((result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Action failed with message ${result.error.message}`);
return;
}
console.log(`Subject: ${result.value}`);
});
...
let subject = "Hello World!";
Office.context.mailbox.item.subject.setAsync(subject, (result) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`Action failed with message ${result.error.message}`);
return;
}
console.log(`Successfully set subject to ${subject}`);
});
メソッドの詳細
addFileAttachmentAsync(uri, attachmentName, options, callback)
ファイルを添付ファイルとしてメッセージまたは予定に追加します。
addFileAttachmentAsync
メソッドは、指定した URI にあるファイルをアップロードし、新規作成フォーム内のアイテムに添付します。
その後、removeAttachmentAsync
メソッドで識別子を使用して同じセッションの添付ファイルを削除できます。
重要: Windows 上の Outlook の最近のビルドでは、ヘッダーを誤ってこのアクションに追加 Authorization: Bearer
するバグが導入されました (この API を使用しているか、Outlook UI を使用しているか)。 この問題を回避するには、要件セット 1.8 で導入された API を使用 addFileAttachmentFromBase64
してみてください。
addFileAttachmentAsync(uri: string, attachmentName: string, options: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult<string>) => void): void;
パラメーター
- uri
-
string
メッセージまたは予定に添付するファイルの場所を示す URI。 最大長は 2048 文字です。
- attachmentName
-
string
添付ファイルのアップロード時に表示される添付ファイルの名前。 最大の長さは、255 文字です。
- options
-
Office.AsyncContextOptions & { isInline: boolean }
次のプロパティの 1 つ以上を含むオブジェクト リテラル:- asyncContext
: 開発者は、コールバック関数でアクセスする任意のオブジェクトを指定できます。 isInline
: true の場合は、添付ファイルがメッセージ本文にインラインで表示され、添付ファイルの一覧に表示されないことを示します。
- callback
-
(asyncResult: Office.AsyncResult<string>) => void
省略可能です。 メソッドが完了すると、 パラメーターで callback
渡された関数が、 型 Office.AsyncResult
の 1 つのパラメーターで呼び出されます。 成功すると、添付ファイルの識別子が asyncResult.value
プロパティに設定されます。 添付ファイルのアップロードに失敗した場合、asyncResult
オブジェクトには、エラーの説明を提供する Error
オブジェクトが含まれます。
戻り値
void
注釈
最小アクセス許可レベル: 項目の読み取り/書き込み
適用される Outlook モード: 予定オーガナイザー
エラー:
AttachmentSizeExceeded
: 添付ファイルが許可されているよりも大きい。FileTypeNotSupported
: 添付ファイルには、許可されていない拡張機能があります。NumberOfAttachmentsExceeded
: メッセージまたは予定に添付ファイルが多すぎます。
例
function callback(result) {
if (result.error) {
console.log(result.error);
} else {
console.log("Attachment added");
}
}
function addAttachment() {
// The values in asyncContext can be accessed in the callback.
const options = { 'asyncContext': { var1: 1, var2: 2 } };
const attachmentURL = "https://contoso.com/rtm/icon.png";
Office.context.mailbox.item.addFileAttachmentAsync(attachmentURL, attachmentURL, options, callback);
}
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/40-attachments/attachments-compose.yaml
const attachmentUrl = $("#attachmentUrl").val();
Office.context.mailbox.item.addFileAttachmentAsync(
attachmentUrl,
getFileName(attachmentUrl),
{ "asyncContext" : { var1: 1, var2: true } },
function(result) { console.log(result); });
addFileAttachmentAsync(uri, attachmentName, callback)
ファイルを添付ファイルとしてメッセージまたは予定に追加します。
addFileAttachmentAsync
メソッドは、指定した URI にあるファイルをアップロードし、新規作成フォーム内のアイテムに添付します。
その後、removeAttachmentAsync
メソッドで識別子を使用して同じセッションの添付ファイルを削除できます。
重要: Windows 上の Outlook の最近のビルドでは、ヘッダーを誤ってこのアクションに追加 Authorization: Bearer
するバグが導入されました (この API を使用しているか、Outlook UI を使用しているか)。 この問題を回避するには、要件セット 1.8 で導入された API を使用 addFileAttachmentFromBase64
してみてください。
addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult<string>) => void): void;
パラメーター
- uri
-
string
メッセージまたは予定に添付するファイルの場所を示す URI。 最大長は 2048 文字です。
- attachmentName
-
string
添付ファイルのアップロード時に表示される添付ファイルの名前。 最大の長さは、255 文字です。
- callback
-
(asyncResult: Office.AsyncResult<string>) => void
省略可能です。 メソッドが完了すると、 パラメーターで callback
渡された関数が、 型 Office.AsyncResult
の 1 つのパラメーターで呼び出されます。 成功すると、添付ファイルの識別子が asyncResult.value
プロパティに設定されます。 添付ファイルのアップロードに失敗した場合、asyncResult
オブジェクトには、エラーの説明を提供する Error
オブジェクトが含まれます。
戻り値
void
注釈
最小アクセス許可レベル: 項目の読み取り/書き込み
適用される Outlook モード: 予定オーガナイザー
エラー:
AttachmentSizeExceeded
: 添付ファイルが許可されているよりも大きい。FileTypeNotSupported
: 添付ファイルには、許可されていない拡張機能があります。NumberOfAttachmentsExceeded
: メッセージまたは予定に添付ファイルが多すぎます。
addItemAttachmentAsync(itemId, attachmentName, options, callback)
メッセージなどの Exchange アイテムを添付ファイルとして、メッセージまたは予定に追加します。
メソッドは addItemAttachmentAsync
、指定された Exchange 識別子を持つアイテムを compose フォームのアイテムにアタッチします。 コールバック関数を指定した場合、 メソッドは、 asyncResult
添付ファイル識別子または項目のアタッチ中に発生したエラーを示すコードを含む 1 つのパラメーターを使用して呼び出されます。 パラメーターを options
使用して、必要に応じて状態情報をコールバック関数に渡すことができます。
その後、removeAttachmentAsync
メソッドで識別子を使用して同じセッションの添付ファイルを削除できます。
Office アドインを Outlook on the web で実行している場合、編集中のアイテム以外のアイテムに addItemAttachmentAsync
メソッドでアイテムを添付できます。ただし、これはサポートされていないため、お勧めできません。
addItemAttachmentAsync(itemId: any, attachmentName: string, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<string>) => void): void;
パラメーター
- itemId
-
any
添付するアイテムの Exchange 識別子。 最大長は 100 文字です。
- attachmentName
-
string
添付ファイルのアップロード時に表示される添付ファイルの名前。 最大の長さは、255 文字です。
- options
- Office.AsyncContextOptions
次のプロパティの 1 つ以上を含むオブジェクト リテラル:- asyncContext
: 開発者は、コールバック関数でアクセスする任意のオブジェクトを指定できます。
- callback
-
(asyncResult: Office.AsyncResult<string>) => void
省略可能です。 メソッドが完了すると、コールバック パラメーターで渡された関数が、 型 Office.AsyncResult
の 1 つのパラメーターで呼び出されます。 成功すると、添付ファイルの識別子が asyncResult.value
プロパティに設定されます。 添付ファイルの追加に失敗した場合、asyncResult
オブジェクトには、エラーの説明を提供する Error
オブジェクトが含まれます。
戻り値
void
注釈
最小アクセス許可レベル: 項目の読み取り/書き込み
適用される Outlook モード: 予定オーガナイザー
エラー:
NumberOfAttachmentsExceeded
: メッセージまたは予定に添付ファイルが多すぎます。
例
// The following example adds an existing Outlook item as an attachment
// with the name `My Attachment`.
function callback(result) {
if (result.error) {
console.log(result.error);
} else {
console.log("Attachment added");
}
}
function addAttachment() {
// EWS ID of item to attach (shortened for readability).
const itemId = "AAMkADI1...AAA=";
// The values in asyncContext can be accessed in the callback.
const options = { 'asyncContext': { var1: 1, var2: 2 } };
Office.context.mailbox.item.addItemAttachmentAsync(itemId, "My Attachment", options, callback);
}
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/40-attachments/attachments-compose.yaml
const attachmentItemId = $("#attachmentItemId").val();
Office.context.mailbox.item.addItemAttachmentAsync(
attachmentItemId,
"My attachment",
{ "asyncContext" : { var3: 3, var4: false } },
function(result) { console.log(result); });
addItemAttachmentAsync(itemId, attachmentName, callback)
メッセージなどの Exchange アイテムを添付ファイルとして、メッセージまたは予定に追加します。
メソッドは addItemAttachmentAsync
、指定された Exchange 識別子を持つアイテムを compose フォームのアイテムにアタッチします。 コールバック関数を指定した場合、 メソッドは、 asyncResult
添付ファイル識別子または項目のアタッチ中に発生したエラーを示すコードを含む 1 つのパラメーターを使用して呼び出されます。 パラメーターを options
使用して、必要に応じて状態情報をコールバック関数に渡すことができます。
その後、removeAttachmentAsync
メソッドで識別子を使用して同じセッションの添付ファイルを削除できます。
Office アドインを Outlook on the web で実行している場合、編集中のアイテム以外のアイテムに addItemAttachmentAsync
メソッドでアイテムを添付できます。ただし、これはサポートされていないため、お勧めできません。
addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult<string>) => void): void;
パラメーター
- itemId
-
any
添付するアイテムの Exchange 識別子。 最大長は 100 文字です。
- attachmentName
-
string
添付ファイルのアップロード時に表示される添付ファイルの名前。 最大の長さは、255 文字です。
- callback
-
(asyncResult: Office.AsyncResult<string>) => void
省略可能です。 メソッドが完了すると、コールバック パラメーターで渡された関数が、 型 Office.AsyncResult
の 1 つのパラメーターで呼び出されます。 成功すると、添付ファイルの識別子が asyncResult.value
プロパティに設定されます。 添付ファイルの追加に失敗した場合、asyncResult
オブジェクトには、エラーの説明を提供する Error
オブジェクトが含まれます。
戻り値
void
注釈
最小アクセス許可レベル: 項目の読み取り/書き込み
適用される Outlook モード: 予定オーガナイザー
エラー:
NumberOfAttachmentsExceeded
: メッセージまたは予定に添付ファイルが多すぎます。
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
注釈
カスタム プロパティの詳細については、「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}`);
}
});
removeAttachmentAsync(attachmentId, options, callback)
メッセージまたは予定から添付ファイルを削除します。
removeAttachmentAsync
メソッドは、指定した識別子の添付ファイルをアイテムから削除します。 ベスト プラクティスとして、同じメール アプリが同じセッションで添付ファイルを追加した場合にのみ、その添付ファイルの識別子を使用して添付ファイルを削除することをお勧めします。 Outlook on the webとモバイル デバイスでは、添付ファイル識別子は同じセッション内でのみ有効です。 ユーザーがアプリを閉じると、またはユーザーがインライン フォームの作成を開始すると、その後フォームがポップアップ表示され、別のウィンドウで続行されます。
removeAttachmentAsync(attachmentId: string, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
パラメーター
- attachmentId
-
string
削除する添付ファイルの識別子。 の最大文字列長attachmentId
は、Outlook on the web および Windows では 200 文字です。
- options
- Office.AsyncContextOptions
次のプロパティの 1 つ以上を含むオブジェクト リテラル:- asyncContext
: 開発者は、コールバック関数でアクセスする任意のオブジェクトを指定できます。
- callback
-
(asyncResult: Office.AsyncResult<void>) => void
省略可能です。 メソッドが完了すると、 パラメーターで callback
渡された関数が、 型 Office.AsyncResult
の 1 つのパラメーターで呼び出されます。 添付ファイルの削除に失敗すると、asyncResult.error
プロパティにはエラー コードとエラーの理由が含まれます。
戻り値
void
注釈
最小アクセス許可レベル: 項目の読み取り/書き込み
適用される Outlook モード: 予定オーガナイザー
エラー:
InvalidAttachmentId
: 添付ファイル識別子が存在しません。
例
// The following code removes an attachment with an identifier of '0'.
Office.context.mailbox.item.removeAttachmentAsync(
'0',
{ asyncContext : null },
function (asyncResult)
{
console.log(asyncResult.status);
}
);
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/40-attachments/attachments-compose.yaml
Office.context.mailbox.item.removeAttachmentAsync(
$("#attachmentId").val(),
{ asyncContext : null },
function(result)
{
if (result.status !== Office.AsyncResultStatus.Succeeded) {
console.error(`${result.error.message}`);
} else {
console.log(`Attachment removed successfully.`);
}
}
);
removeAttachmentAsync(attachmentId, callback)
メッセージまたは予定から添付ファイルを削除します。
removeAttachmentAsync
メソッドは、指定した識別子の添付ファイルをアイテムから削除します。 ベスト プラクティスとして、同じメール アプリが同じセッションで添付ファイルを追加した場合にのみ、その添付ファイルの識別子を使用して添付ファイルを削除することをお勧めします。 Outlook on the webとモバイル デバイスでは、添付ファイル識別子は同じセッション内でのみ有効です。 ユーザーがアプリを閉じると、またはユーザーがインライン フォームの作成を開始すると、その後フォームがポップアップ表示され、別のウィンドウで続行されます。
removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
パラメーター
- attachmentId
-
string
削除する添付ファイルの識別子。 の最大文字列長attachmentId
は、Outlook on the web および Windows では 200 文字です。
- callback
-
(asyncResult: Office.AsyncResult<void>) => void
省略可能です。 メソッドが完了すると、 パラメーターで callback
渡された関数が、 型 Office.AsyncResult
の 1 つのパラメーターで呼び出されます。 添付ファイルの削除に失敗すると、asyncResult.error
プロパティにはエラー コードとエラーの理由が含まれます。
戻り値
void
注釈
最小アクセス許可レベル: 項目の読み取り/書き込み
適用される Outlook モード: 予定オーガナイザー
エラー:
InvalidAttachmentId
: 添付ファイル識別子が存在しません。
Office Add-ins
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示