Office.AttachmentDetails interface
サーバーからのアイテムの添付ファイルを表します。 閲覧モードのみ。
AttachmentDetailsオブジェクトの配列は、予定またはメッセージ アイテムの attachments プロパティとして返されます。
注釈
最小アクセス許可レベル: 項目の読み取り
適用可能な Outlook モード: 読み取り
使用元
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/40-attachments/get-attachments-read.yaml
const item = Office.context.mailbox.item;
if (item.attachments.length > 0) {
for (let i = 0; i < item.attachments.length; i++) {
const attachment = item.attachments[i];
console.log(`${i+1}. Name: ${attachment.name}`);
console.log(`ID: ${attachment.id}`);
console.log(`Type: ${attachment.attachmentType}`);
console.log(`Inline content: ${attachment.isInline}`);
console.log(`Size: ${attachment.size}`);
}
} else {
console.log("This mail item doesn't contain any attachments.");
}
プロパティ
| attachment |
添付ファイルの種類を示す値を取得します。 |
| content |
添付ファイルの MIME コンテンツ タイプを取得します。
警告: |
| id | 添付ファイルの Exchange 添付ファイル ID を取得します。 ただし、添付ファイルの種類が |
| is |
添付ファイルが添付ファイル リストではなくアイテムの本文に画像として表示されるかどうかを示す値を取得します。 |
| name | 添付ファイルの名前を取得します。 |
| size | 添付ファイルのサイズをバイト単位で取得します。 |
プロパティの詳細
attachmentType
添付ファイルの種類を示す値を取得します。
attachmentType: MailboxEnums.AttachmentType | string;
プロパティ値
Office.MailboxEnums.AttachmentType | string
contentType
警告
この API は非推奨になりました。
If you require specific content types, grab the attachment's extension and process accordingly.
添付ファイルの MIME コンテンツ タイプを取得します。
警告: contentType 値は添付ファイルの拡張子の直接参照ですが、内部マッピングはアクティブに維持されないため、このプロパティは非推奨になりました。 特定のタイプが必要な場合は、添付ファイルの拡張機能を取得し、それに応じて処理します。 詳細については、関連するブログ記事を参照してください。
contentType: string;
プロパティ値
string
id
添付ファイルの Exchange 添付ファイル ID を取得します。 ただし、添付ファイルの種類が MailboxEnums.AttachmentType.Cloud の場合は、ファイルの URL が返されます。
id: string;
プロパティ値
string
isInline
添付ファイルが添付ファイル リストではなくアイテムの本文に画像として表示されるかどうかを示す値を取得します。
isInline: boolean;
プロパティ値
boolean
name
添付ファイルの名前を取得します。
name: string;
プロパティ値
string
注釈
重要: 添付ファイルの種類 Office.MailboxEnums.AttachmentType.Item は、 name プロパティでファイル名拡張子を返しません。
size
添付ファイルのサイズをバイト単位で取得します。
size: number;
プロパティ値
number