Previous Topic: rollTimeNext Topic: setOperatorStatus


saveAttachmentToFile

The saveAttachmentToFile function saves the content of an attachment, identified by a unique ID, to the specified file location. The function returns the absolute path of the new file with the attachment content.

Syntax

sFileName = saveAttachmentToFile(nAttachmentID, sFileDirName)

Arguments

lAttachmentID (long)

Specifies a unique ID that identifies the attachment containing the desired content.

sFileDirName (String)

Full path and file name to the location where the file will be written.

If a file path is not provided, then the file will be written to the install_dir/server/c2o directory.

If a file is not specified, a unique file will be generated.

If only a path is specified, the path must include the path separator character at the end of the path (‘\’ for Windows or ‘/’ for UNIX).

Return Value

sFileName (C2OString)

The full path to the file, including the file name, is returned if the function is successful. If the function fails, NULL is returned. The return type is C2OString.

Example

var  i = Process.attachments[0].attachmentID;
Process.save =  saveAttachmentToFile( i, "attach.txt");