@AttachmentLengths (Formula Language)

Returns a number or a number list containing the length of each attachment to the current document. The number(s) returned are only approximations; the actual size(s) of the attachment(s) may be slightly different.

Syntax

@AttachmentLengths( excludeMIMEBody )

Parameters

excludeMIMEBody

Boolean. Optional.

  • Specify True (1) to exclude large MIME parts that are stored as attachments (but displayed in-line). This is the default.
  • Specify False (0) to include large MIME parts that are stored as attachments (but displayed in-line).

Return value

sizeInBytes

Number or number list.

  • If the current document contains one attachment, sizeInBytes is a number representing the size of that attachment in bytes.
  • If the current document contains more than one attachment, sizeInBytes is a number list where each number in the number list is the size of one of the attachments, in bytes.

Usage

The attachment size is computed based on uncompressed file size (that is, the number of bytes the attachment would use if you extracted it); the actual disk storage space required for the file may be somewhat smaller.

@AttachmentLengths returns an empty list if there are no attachments. If there is one attachment of length 0, @AttachmentLengths returns 0.

Examples

  1. This example returns 6102 if that is the approximate size of the single, attached file.
    @AttachmentLengths
  2. This example, given a semicolon as the multi-value separator, returns AUTOEXEC.BAt:112;CONFIG.SYS:1549;Q4SALES.WK4:17636 if those are the names and lengths of the files attached.
    @AttachmentNames + ":" + @Text(@AttachmentLengths)
  3. This example returns 0 if there is one attachment of length 0.
    @AttachmentLengths
  4. This example returns an empty list (no value appears at all) if there are no attachments.
    @AttachmentLengths
  5. This example sums the attachment lengths, checking first to make sure there are attachments.
    @Sum(@Attachments > 0; @AttachmentLengths; 0)