I have a report that I am running through NAS that will create a PDF file in a specified directory. When I run the report interactively, it works. In the Event Viewer, I get the following messages:
Event Type: Information
Event Source: Print
Event Category: None
Event ID: 10
Date: 5/10/2011
Time: 12:58:56 PM
User: HEATHCO\SVC_NAVNAS_CA
Computer: TR-AP-01T
Description:
Document 3, Dollar Report - Item Category2 owned by SVC_NAVNAS_CA was printed on Bullzip PDF Printer via port BULLZIP. Size in bytes: 56712; pages printed: 2
Which is immediately followed by
Event Type: Information
Event Source: Print
Event Category: None
Event ID: 13
Date: 5/10/2011
Time: 12:58:56 PM
User: NT AUTHORITY\SYSTEM
Computer: TR-AP-01T
Description:
Document 3, Dollar Report - Item Category2 owned by SVC_NAVNAS_CA was deleted on Bullzip PDF Printer.
The entire process is designed to create a PDF and then e-mail the file to a list of recipients. What is odd is that the process deleting the file is kicked off by the SYSTEM account so there is some trigger event that's causing this to happen.
Couple of observations:
1) If I run the process interactively, the file is created in the specified folder and e-mailed. If I leave the file, the NAS process will attempt to create a new file which gets deleted but it will e-mail the existing file. This tells me that the NAS has permissions to read this folder.
2) The NAS service has been given full domain prvilieges
3) The process fails on both a local drive and network drive
4) Verified that I can log on to the server under the NAS account and perform file transactions (create, delete, etc.) on the folders in observation (3)
5) NAS is used to print files to standard printers
6) Microsoft had posted a fix (
http://support.microsoft.com/kb/909906) for a similar problem that was occuring on Windows 2003 SP1 Servers, but we are at SP2 so the patch has been applied.
What I can't figure out is why the document is getting deleted immediately after it is created. The run-time properties for BullZip are as follows. I've tried a few different setups, but nothing seemed to make a difference:
IF ISCLEAR(BullZipPDF) THEN
CREATE(BullZipPDF);
FileName := JobQueueSetup."Output Directory" + FileName + ' (' + FORMAT(Month) + '-' + FORMAT(Day) + '-' + FORMAT(Year) + ').pdf';
BullZipPDF.Init;
BullZipPDF.LoadSettings;
RunOnceFile := BullZipPDF.GetSettingsFileName(TRUE);
BullZipPDF.SetValue('Output',FileName);
BullZipPDF.SetValue('Showsettings', 'never');
BullZipPDF.SetValue('ShowPDF', 'no');
BullZipPDF.SetValue('ShowProgress', 'no');
BullZipPDF.SetValue('ShowProgressFinished', 'no');
BullZipPDF.SetValue('SuppressErrors', 'yes');
BullZipPDF.SetValue('ConfirmOverwrite', 'no');
BullZipPDF.WriteSettings(TRUE);
Any ideas or suggestions?
Answers
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
if exists(filelocation) then
erase(filelocation);
Also add some code to make the file name unique. For example add OrderNo or CustomerNo to the file name, so that it doesn't pick up the wrong file.
You would have to change the code for if exists then erase to loop through virtual file table and find any pdf files and delete them all.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n