Office.MailboxEnums.AttachmentType enum

添付ファイルの種類を指定します。

注釈

適用できる Outlook モード: 新規作成または読み取り

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/40-attachments/attachments-compose.yaml

Office.context.mailbox.item.getAttachmentsAsync(function (result) {
    if (result.status !== Office.AsyncResultStatus.Succeeded) {
        console.error(result.error.message);
    } else {
        if (result.value.length > 0) {
            for (let i = 0; i < result.value.length; i++) {
                const attachment = result.value[i];
                console.log("ID: " + attachment.id + "\n" +
                    "Name: " + attachment.name + "\n" +
                    "Size: " + attachment.size + "\n" +
                    "isInline: " + attachment.isInline);
                switch (attachment.attachmentType) {
                    case Office.MailboxEnums.AttachmentType.Cloud:
                        console.log("Attachment type: Attachment is stored in a cloud location.");
                        break;
                    case Office.MailboxEnums.AttachmentType.File:
                        console.log("Attachment type: Attachment is a file.");
                        break;
                    case Office.MailboxEnums.AttachmentType.Item:
                        console.log("Attachment type: Attachment is an Exchange item.");
                        break;
                }
            }
        }
        else {
            console.log("No attachments on this message.");
        }
    }
});

フィールド

File = "file"

この添付ファイルはファイルです。

Item = "item"

この添付ファイルは Exchange のアイテムです。

Cloud = "cloud"

添付ファイルは、OneDrive などのクラウドの場所に格納されます。

重要: 読み取りモードでは、 id 添付ファイルの details オブジェクトのプロパティにファイルの URL が含まれます。 要件セット 1.8 から、 url 添付ファイルの details オブジェクトに含まれるプロパティには、新規作成モードのファイルへの URL が含まれています。