Office.AttachmentContent interface
メッセージまたは予定アイテムの添付ファイルの内容を表します。
注釈
最小アクセス許可レベル: 読み取り項目
適用できる Outlook モード: Composeまたは読み取り
例
Office.context.mailbox.item.getAttachmentsAsync((result) => {
if (result.value.length > 0) {
for (let i = 0 ; i < result.value.length ; i++) {
Office.context.mailbox.item.getAttachmentContentAsync(result.value[i].id, handleAttachmentsCallback);
}
}
});
function handleAttachmentsCallback(result) {
// Identify if an attachment is a Base64-encoded string, .eml file, .icalendar file, or a URL.
switch (result.value.format) {
case Office.MailboxEnums.AttachmentContentFormat.Base64:
// Handle file attachment.
console.log("Attachment is a Base64-encoded string.");
break;
case Office.MailboxEnums.AttachmentContentFormat.Eml:
// Handle email item attachment.
console.log("Attachment is a message.");
break;
case Office.MailboxEnums.AttachmentContentFormat.ICalendar:
// Handle .icalender attachment.
console.log("Attachment is a calendar item.");
break;
case Office.MailboxEnums.AttachmentContentFormat.Url:
// Handle cloud attachment.
console.log("Attachment is a cloud attachment.");
break;
default:
// Handle attachment formats that aren't supported.
}
// Log the content of the attachments as a string.
console.log(result.value.content);
}
プロパティ
content | 添付ファイルの内容を文字列として指定します。 |
format | 添付ファイルのコンテンツに使用する文字列形式。 添付ファイルの場合、書式設定は Base64 でエンコードされた文字列です。 メッセージを表し、ドラッグ アンド ドロップまたは "アイテムの添付" によって添付されたアイテムの添付ファイルの場合、書式設定は、.eml形式のファイルを表す文字列です。 予定表アイテムを表し、ドラッグ アンド ドロップまたは "アイテムの添付" によって添付されたアイテムの添付ファイルの場合、書式設定は .icalendar ファイルを表す文字列です。
重要: Outlook on the webまたは新しい Outlook on Windows でドラッグ アンド ドロップしてメッセージまたは予定表アイテムが添付されている場合、 クラウド添付ファイルの場合、書式設定は URL 文字列です。 |
プロパティの詳細
content
添付ファイルの内容を文字列として指定します。
content: string;
プロパティ値
string
format
添付ファイルのコンテンツに使用する文字列形式。
添付ファイルの場合、書式設定は Base64 でエンコードされた文字列です。
メッセージを表し、ドラッグ アンド ドロップまたは "アイテムの添付" によって添付されたアイテムの添付ファイルの場合、書式設定は、.eml形式のファイルを表す文字列です。
予定表アイテムを表し、ドラッグ アンド ドロップまたは "アイテムの添付" によって添付されたアイテムの添付ファイルの場合、書式設定は .icalendar ファイルを表す文字列です。
重要: Outlook on the webまたは新しい Outlook on Windows でドラッグ アンド ドロップしてメッセージまたは予定表アイテムが添付されている場合、getAttachmentContentAsync
はエラーをスローします。
クラウド添付ファイルの場合、書式設定は URL 文字列です。
format: MailboxEnums.AttachmentContentFormat | string;