namespace WorkflowActivity.Scripting.ExporttoServerFolder { using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Text; using Laserfiche.RepositoryAccess; using Laserfiche.DocumentServices; using System.IO; /// /// Provides one or more methods that can be run when the workflow scripting activity is performed. /// public class Script1 : RAScriptClass91 { /// /// This method is run when the activity is performed. /// protected override void Execute() { // Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session String sMasterLogLocation = "Z:\\EXPORT\\LOG_"+DateTime.Now.ToString("yyyyMMdd") + ".txt"; try { EntryInfo inf = Entry.GetEntryInfo(this.BoundEntryId, this.RASession); DocumentInfo doc = (DocumentInfo)inf; string sChannel = "VAL"; string sAppNumber = doc.GetFieldValue("Application Number").ToString(); string sDocCreationTime = doc.CreationTime.ToString("yyyyMMddHHmmss"); string sDocCreationDate = doc.CreationTime.ToString("yyyyMMddHH"); int nEntryID = doc.Id; string sFileName = sChannel + "_" + sAppNumber + "_" + nEntryID + "_" + sDocCreationTime; DocumentExporter docExporter = new DocumentExporter(); string sFilePath = "Z:\\EXPORT\\" + doc.CreationTime.ToString("yyyy") + "\\"+ doc.CreationTime.ToString("MM") + "\\" + doc.CreationTime.ToString("dd") + "\\" + doc.CreationTime.ToString("HH"); if (!System.IO.Directory.Exists(sFilePath)) { System.IO.Directory.CreateDirectory(sFilePath); } string sTempFileName = sFilePath+"\\"+sFileName + ".tif"; string sFolderLogLocation = sFilePath + "\\LOG_" + sDocCreationDate + ".txt"; //Export IDocumentContents doc2 = doc.GetLatestVersion(); docExporter.BlackoutRedactions = true; docExporter.ExportPages(doc2, doc.AllPages, sTempFileName); WriteLogs(sTempFileName, sFolderLogLocation); WriteLogs(sTempFileName, sMasterLogLocation); } catch (Exception ex) { WriteLogs(ex.ToString(),sMasterLogLocation); } } public void WriteLogs(string sLog, string sLogLocation) { StreamWriter sw = new StreamWriter(sLogLocation, true); sw.WriteLine(DateTime.Now.ToString("yyyyMMddHHmmss") + "||" + sLog); sw.Close(); } } }