I am trying to use the new Download to move a tempfile created from the servicetier to the users workstation.
But I get "an I/O exception occured during the operation" error message.
The error occurs on the DOWNLOAD Line, the temp file is created succcessfully in the RTC and everything works fine in the classic client.
Can anyone explain the DOWNLOAD more, the help is not too informative.
IF ISSERVICETIER THEN BEGIN
ProfileFile.CREATETEMPFILE;
ExportTxtLines;
DOWNLOAD(ProfileFile.NAME, 'Download File','C:\',Text002,FileName);
END ELSE BEGIN
ProfileFile.CREATE(FileName);
ProfileFile.CLOSE;
ExportTxtLines;
END;
0
Comments
Your next problem is that you cannot get the filename if the file isn't open.
And I cannot remember when we clean those files up - but the safest way is using the following construct:
// Get Temp FileName
TempFile.CREATETEMPFILE;
FileName := TempFile.NAME;
TempFile.CLOSE;
To get the filename - now create a new file in that filename., write to it, download it and delete it.
You can find more on my blog in the following post:
http://blogs.msdn.com/freddyk/archive/2008/11/04/transferring-data-to-from-com-automation-objects-and-webservices.aspx
Group Program Manager, Client
Microsoft Dynamics NAV
http://blogs.msdn.com/freddyk
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
That fixed it!!
REPORT.SAVEASPDF(301, 'D:\Temp\default.pdf', Vendor);
ToFile := STRSUBSTNO('Vendor No. %1.pdf', vendor."No.");
PdfDownloaded := DOWNLOAD('D:\Temp\default.pdf', 'Save PDF As..', 'D:\','PDF file(*.pdf)|*.pdf', ToFile );
when i run this report in the RTC an error occured "An I/O Exception occured during the operation". pls help me from this error....
:-k
try to create a new codeunit and move your code in its onrun trigger. In this way you can familiarize with the saveaspdf function easily.
edit: you have to run the codeunit from the RTC, obviously (under an action in a page for example), because saveaspdf works only for rdlc reports
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog