Call this function to add an attachment to the folder.

syntaxSyntax:
DlxFolder.NewAttachment(fileName = "", name = "", mode = DlxApp.IFEXIST_REPLACE)

Parameters

Parameter Description
fileName The full path to the file. If this string is empty, a dialog box appears where you can specify the file name.
name The attachment name. If the name is not specified, the file name is used.
mode The operation to be performed if an attachment with the same name already exists. Specify one of the following values.
Value Meaning
DlxApp.IFEXIST_REPLACE If an attachment with the specified name already exists, the content is replaced with the specified file.
DlxApp.IFEXIST_SKIP If an attachment with the specified name already exists, the operation is canceled.
DlxApp.IFEXIST_ADDNEW If an attachment with the specified name already exists, the attachment is added anyway.

Return Value

Returns the object corresponding to the attachment. Call the IsValid() method to determine if the attachment was created correctly.

Example

  Copy codeCopy code
var folder = DlxApp.GetJob().GetFolder("folder1");
if (folder.IsValid())
{
  if (!folder.NewAttachment("image.jpg", "att1").IsValid())
  {
    throw new Error("An error occurred while creating the attachment.");
  }
}

See also