I have this code in a C# script Workflow:
I get the Id from a entry that Import Agent impor to our repository.
int.TryParse(this.GetTokenValue("Entry ID").ToString(), out id);
public void ExportEntries(int id) { try { DocumentInfo docInfo = Document.GetDocumentInfo(id, RASession); DocumentExporter docEx = new DocumentExporter(); docEx.PageFormat = DocumentPageFormat.Tiff; docEx.CompressionQuality = 90; if(!Directory.Exists(@"E:\PathToExportEntriesTiff\")) { Directory.CreateDirectory(@"E:\PathToExportEntriesTiff\"); } docEx.ExportPages(docInfo, docInfo.AllPages, @"E:\PathToExportEntriesTiff\" + docInfo.Name + ".tif"); docInfo.Dispose(); } catch(Exception ex) { string filePath = @"E:\PathToExportEntriesTiff\ERROR_TO_EXPORT.txt"; using (StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine("Response :" + ex.Message + Environment.NewLine + "" + Environment.NewLine + "Numero Contrato: " + this.GetTokenValue("Entry Name").ToString() + "" + Environment.NewLine + "Path: " + this.GetTokenValue("Entry Path")); writer.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine); } } }
And i'm getting this error => The process cannot access the file '**********' because it is being used by another process.
Someone could explain why ?