Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter SixFile Functions (continued)

MIMEItemToString Function

Overview

The MIMEItemToString function extracts an entry from a MIME Object to a string. Entry content must not contain any zero bytes.

Syntax/Parameters

Syntax

string = MIMEItemToString ( handle hMIME, int index );

Parameters

hMIME

A handle for a MIME Object created with the MIMEOpen function.

index

An int specifying the zero-based index for an item within the MIME Object.

Return Value

Returns a string containing the decoded item data or empty on failure. Use the GetLastError to retrieve a formatted error code.

Remarks

This function decodes the content of an item and returns a string containing the data. Since a string cannot contain raw binary data, if a zero appears in the decoded data, an empty string and the code ERROR_CONTEXT will be returned.

If a content-alternate layer entry is selected, it is automatically an 8-bit ASCII string. It is up to the caller to decode the content.

Note that depending on the layer, an entry will return data for more than one encoded boundary layer. For example, in an EML file, there is usually a layer containing Text and HTML and then separate boundaries for Text and HTML within that layer. For example, data from MIMEGetItemProperties function:

0 -    Layer                    : 0
       Name                     : 
       Encoding                 : 
       Content-Type             : multipart/alternative
       FileTypeString           : 

1 -    Layer                    : 1
       Name                     : 
       Encoding                 : 7bit
       Content-Type             : text/plain
       FileTypeString           : FT_ANSI

2 -    Layer                    : 1
       Name                     : 
       Encoding                 : quoted-printable
       Content-Type             : text/html
       FileTypeString           : FT_HTML

3 -    Layer                    : 0
       Name                     : zzz-20181231.xfr
       Encoding                 : quoted-printable
       Content-Type             : application/octet-stream
       FileTypeString           : FT_XFR

Notice entry 1 is “multipart/alternative” and layer 0 while the two following entries are layer 1 as “text/plain” and “text/html”, respectively. Retrieving item 0 will result in capturing the raw code for both layer 1 items.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic