Undocumented "feature" of DOWNLOADFROMSTREAM?

rocatis
Member Posts: 163
The setup is the following: standard 6.01 demo installation, running both the Classic Client and RTC on the same machine (not optimal, I know).
Make the following changes to function BLOBExport in codeunit 419 "3-Tier Automation Mgt.":
Before calling DOWNLOADFROMSTREAM
Path=[<TEMP>]
ToFile=[test.txt]
After calling DOWNLOADFROMSTREAM
Path=[<TEMP>]
ToFile=[C:\Documents and Settings\brocatis3101\Local Settings\Temp\Microsoft Dynamics NAV\3868\__TEMP__3bcc9a646f464b00be8c4eaca47f5bc5.txt]
So the ToFile parameter is modified by the DOWNLOADFROMSTREAM command. This is not documented anywhere (what a surprise :shock: ). Thing is, the parameter is only changed if the Path parameter is set to "MagicPath" (<TEMP>) which apparently is the secret way to avoid the "Save As" dialog (again, undocumented).
I want to save the file with the filename I supply, but without opening the "Save As" dialog. How do I do that?
Make the following changes to function BLOBExport in codeunit 419 "3-Tier Automation Mgt.":
MESSAGE('Before calling DOWNLOADFROMSTREAM\Path=[%1]\ToFile=[%2]',path,tofile); // Debug DOWNLOADFROMSTREAM(NVInStream,Text006,Path,Text009,ToFile); MESSAGE('After calling DOWNLOADFROMSTREAM\Path=[%1]\ToFile=[%2]',path,tofile); // DebugI call the function using this bit of code:
ThreeTierAutomationMgt.BLOBExport(TempBlob,'c:\test.txt',FALSE));The expected result is that the (text) file contained in TempBlob.Blob is exported as test.txt in c:\ of the RTC (which, incidentally is the same as c:\ of my Classic Client). However, running the code yields these results:
Before calling DOWNLOADFROMSTREAM
Path=[<TEMP>]
ToFile=[test.txt]
After calling DOWNLOADFROMSTREAM
Path=[<TEMP>]
ToFile=[C:\Documents and Settings\brocatis3101\Local Settings\Temp\Microsoft Dynamics NAV\3868\__TEMP__3bcc9a646f464b00be8c4eaca47f5bc5.txt]
So the ToFile parameter is modified by the DOWNLOADFROMSTREAM command. This is not documented anywhere (what a surprise :shock: ). Thing is, the parameter is only changed if the Path parameter is set to "MagicPath" (<TEMP>) which apparently is the secret way to avoid the "Save As" dialog (again, undocumented).
I want to save the file with the filename I supply, but without opening the "Save As" dialog. How do I do that?
Brian Rocatis
Senior NAV Developer
Elbek & Vejrup
Senior NAV Developer
Elbek & Vejrup
0
Comments
-
The RTC exports to the Service machine, and I guess for RTC this is the TEMP directory... :roll:-Mihail- [MCTS]0
-
mihail_kolev wrote:The RTC exports to the Service machine, and I guess for RTC this is the TEMP directory... :roll:
Yes and no. The real problem is that it seems that the only way to bypass the user dialog is to specify "<TEMP>" as the path - and that in turn results in the file being saved in the folder specified by the TEMP environment variable.
It look decidedly dodgy :thumbsdown:Brian Rocatis
Senior NAV Developer
Elbek & Vejrup0 -
rocatis wrote:I want to save the file with the filename I supply, but without opening the "Save As" dialog. How do I do that?
For this reason, the RTC should decide where to download files when then dialog box is bypassed.
That fact that the method for bypassing the dialog box has been implemented in such a clumsy, undocumented and downright “un-NAV” way is just unfortunate.Brian Rocatis
Senior NAV Developer
Elbek & Vejrup0 -
Has anyone figured out a way to get round this? I have a simialr problem with the DOWNLOAD.
I have generated a text file on the service tier and need to move it to a network share without the user having to select the file path.
The customer wants specific people to be able to generate a electronic funds payment file but they don't want them to be able to access it after it has been generated. the actual passing of the file to the banking software is handled by someone else with enough permission to read the file.
Effectively the user that will crete the file has write only permission on the network share. However I cannot suppress the save path box. I have also tried setting the file to be generated directly to the desired path instead of on the service tier but that also fails.
Regards
IanRegards
Ian0 -
I think that the path do do that is to save it into TEMP folder (to not display the dialog) and than rename it from the autogenerated name to the real name and path you want...0
-
Ian_Piddington wrote:Has anyone figured out a way to get round this? I have a simialr problem with the DOWNLOAD.
Did you check my blog?
http://mibuso.com/blogs/mohana/2011/02/20/file-export-in-rtc-with-%E2%80%9Ccommon-dialog-management%E2%80%9D/0 -
Regards
Ian0 -
Glad it helped atleast one.0
-
this is my bible for this kind of problems, but it's been a while since i've used the download function the last time. Probably it's outdated :-k
http://blogs.msdn.com/b/nav-reporting/archive/2009/10/08/send-email-with-pdf-attachment-in-nav-2009.aspx0 -
I am also facing same issue with DOWNLOADFROMSTREAM. Is this a bug?
DOWNLOADFROMSTREAM(NVInStream,Text006,Path,Text009,ToFile);
For a workaround can I set the 'Path' parameter to the 'ToFile' directory path. Will it resolve the issue? Or it may lead into other issues?
@rocatis : Did you figure out the way to resolve it? Please let me know. Thanks.0 -
Do you want to save it without save as window?0
-
Yes, you are right. I want to save file at defined location without opening pop up window.0
-
Did you check my blog link?0
-
I debugged the code and actually I am getting dialog window during BLOB Import i.e. UPLOADINTOSTREAM function in BLOBImport() in CU 419.
I have rewritten new function called BLOBImportWOCommDialog which will download my server file to client Temp folder (i.e. Magicpath (<TEMP>)) and then upload it .PROCEDURE BLOBImportWOCommDialog@1170000000(VAR BLOBRef@1000 : TEMPORARY Record 99008535;Name@1002 : Text) : Text; VAR NVInStream@1001 : InStream; NVOutStream@1004 : OutStream; UploadResult@1006 : Boolean; ErrorMessage@1007 : Text; FileSystemObject@1170000000 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{0D43FE01-F093-11CF-8940-00A0C9054228}:'Windows Script Host Object Model'.FileSystemObject"; Path@1170000003 : Text[1024]; FileVar@1170000005 : File; TempFolder@1170000006 : Text[1024]; FileToUpload@1170000007 : Text[1024]; FolderName@1170000008 : Text[1024]; TempFileName@1170000001 : Text[1024]; FileExtension@1003 : Text; BEGIN CLEARLASTERROR; //Commented standard code //UploadResult := UPLOADINTOSTREAM(Text007,'',Text009,Name,NVInStream); FileToUpload := Name; //Added New Line FileToUpload := DownloadTempFile(FileToUpload); //Added New Line UploadResult := UPLOADINTOSTREAM('',Magicpath,'',FileToUpload,NVInStream); //Added New Line IF UploadResult THEN BEGIN BLOBRef.Blob.CREATEOUTSTREAM(NVOutStream); COPYSTREAM(NVOutStream,NVInStream); EXIT(Name); END; ErrorMessage := GETLASTERRORTEXT; IF ErrorMessage <> '' THEN ERROR(ErrorMessage); EXIT(''); END;
I called above function from my code as below:
FileName := FileMgt.BLOBImportWOCommDialog(TempBlob,lFile);
IF FileName <> '' THEN
lLoggLine.FileData := TempBlob.Blob;
lLoggLine.MODIFY;
It worked successfully without popping out dialog window as I am uploading file from local <TEMP> folder.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions