5.22.5 SAVE
The SAVE command is used to save various components of the current message to a local file (or files).
Syntax:
Command
|
Keyword
|
Value
|
Developer notes
|
SAVE
|
OBJECT
|
*TEXT
|
Indicates that the body text of the message is to be saved. If the message content-type does not start with text/ or multipart/ the command returns a value of NOTEXT in the status field.
|
*ATTACHMENT
|
Use this value to nominate a specific attachment to be saved. This value, in combination with the ENTRY or SELECT keywords identifies the attachment to be saved. If neither ENTRY nor SELECT is specified, the first attachment is saved. If there are no attachments associated with the current message the command status is returned as NOATTACHMENT.
|
*ATTACHMENTS
|
This value saves all attachments to the directory specified by the keyword DIR using the attachment file name. If there are no attachments associated with the current message, the command status is returned as NOATTACHMENT.
|
ENTRY
|
integer
|
Specify the file number of the attachment to be read. The number assigned to each attachment is determined by the order the attachments were added to the email by the sender. Default is 1.
|
SELECT
|
value
|
Select an attachment file to be read based on the attached file name.
|
FILE
|
value
|
This keyword specifies the local file name where the information is to be saved.
Any path details included in the FILE value must already exist. The file itself will be created or replaced as required.
If OBJECT(*TEXT) is used: a file name must be provided here.
If OBJECT(*ATTACHMENT) is used: the current attachment file will be renamed to the file name indicated.
If OBJECT(*ATTACHMENTS) is used: the FILE keyword is ignored.
|
DIR
|
value
|
The local directory where the file is to be saved. By default, the JSM instance directory is used.
If the DIR path does not already exist it will be created.
|
|
Example
SAVE OBJECT(*TEXT) FILE(/folder/file.txt)
SAVE OBJECT(*ATTACHMENT) ENTRY(2) FILE(/folder/file.xml)
SAVE OBJECT(*ATTACHMENT) SELECT(order.csv) FILE(/folder/file.csv)
SAVE OBJECT(*ATTACHMENTS) DIR(/folder)