Office.AttachmentDetails interface

Represents an attachment on an item from the server. Read mode only.

An array of AttachmentDetails objects is returned as the attachments property of an appointment or message item.

Remarks

[ API set: Mailbox 1.1 ]

Minimum permission level: read item

Applicable Outlook mode: Read

Examples

// The following code builds an HTML string with details
// of all attachments on the current item.
const item = Office.context.mailbox.item;
let outputString = "";

if (item.attachments.length > 0) {
    for (let i = 0 ; i < item.attachments.length ; i++) {
        const attachment = item.attachments[i];
        outputString += "<BR>" + i + ". Name: ";
        outputString += attachment.name;
        outputString += "<BR>ID: " + attachment.id;
        outputString += "<BR>contentType: " + attachment.contentType;
        outputString += "<BR>size: " + attachment.size;
        outputString += "<BR>attachmentType: " + attachment.attachmentType;
        outputString += "<BR>isInline: " + attachment.isInline;
    }
}

console.log(outputString);

Properties

attachmentType

Gets a value that indicates the type of an attachment.

contentType

Gets the MIME content type of the attachment.

Warning: While the contentType value is a direct lookup of the attachment's extension, the internal mapping isn't actively maintained so this property has been deprecated. If you require specific types, grab the attachment's extension and process accordingly. For details, refer to the related blog post.

id

Gets the Exchange attachment ID of the attachment. However, if the attachment type is MailboxEnums.AttachmentType.Cloud, then a URL for the file is returned.

isInline

Gets a value that indicates whether the attachment should be displayed in the body of the item.

name

Gets the name of the attachment.

Important: For message or appointment items that were attached by drag-and-drop or "Attach Item", name includes a file extension in Outlook on Mac, but excludes the extension on the web or Windows.

size

Gets the size of the attachment in bytes.

Property Details

attachmentType

Gets a value that indicates the type of an attachment.

attachmentType: MailboxEnums.AttachmentType | string;

Property Value

contentType

Warning

This API is now deprecated.

If you require specific content types, grab the attachment's extension and process accordingly.

Gets the MIME content type of the attachment.

Warning: While the contentType value is a direct lookup of the attachment's extension, the internal mapping isn't actively maintained so this property has been deprecated. If you require specific types, grab the attachment's extension and process accordingly. For details, refer to the related blog post.

contentType: string;

Property Value

string

id

Gets the Exchange attachment ID of the attachment. However, if the attachment type is MailboxEnums.AttachmentType.Cloud, then a URL for the file is returned.

id: string;

Property Value

string

isInline

Gets a value that indicates whether the attachment should be displayed in the body of the item.

isInline: boolean;

Property Value

boolean

name

Gets the name of the attachment.

Important: For message or appointment items that were attached by drag-and-drop or "Attach Item", name includes a file extension in Outlook on Mac, but excludes the extension on the web or Windows.

name: string;

Property Value

string

size

Gets the size of the attachment in bytes.

size: number;

Property Value

number