How to save a Batch's attachments to local disk drive?

Question

How to automatically save a Batch's attachments to a local disk drive via. scripting?

Answer

Before the Export stage in the Advanced Workflow-> create a Scripting stage

mceclip0.png

 

and in this script stage, add these scripts below to check if the batch has any attachments that exist, if yes then save these attachments to the local disk drive.

if(Batch.Attachments.IsEmpty == false)
{
  Processing.ReportMessage("Batch: " + Batch.Id + " has attachments");
  for(int i = 0; i < Batch.Attachments.Names.Count; i++)
  {
    string name = (string)Batch.Attachments.Names[i];
    Batch.Attachments.Get(name).ToFile("c:\\temp\\myoutput"+ i + ".pdf");
  }
}

 

 

 

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.