Custom .NET scripts embedded into the FlexiCapture 12 Rules, stages, event handlers, that should work with files, directories, threads sometimes are not executed correctly.
To properly execute the code that works with files/directories/threads, the user under which the Processing Station service is running, should have the permissions to access the objects used in such scripts.
StreamWriter class of the System.IO namespace works with files and directories.
Here is a code snippet:
StreamWriter sw = new StreamWriter("C:\\temp\\Test.txt",true);
//Write a line of text
//Write a second line of text
sw.WriteLine("From the StreamWriter class"+ docWithErrors.ToString());
//Close the file
If the Processing Station is run under Network Service:
then the folder "C:\temp" and file "Test.txt" used in the script should have read & write permissions granted to the Network Service.