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
には Outlook on Mac のファイル拡張子が含まれますが、Web または Windows 上の拡張機能は除外されます。
name: string;
プロパティ値
string
size
添付ファイルのサイズをバイト単位で取得します。
size: number;
プロパティ値
number
Office Add-ins