rnjbngrnjbng Member Posts: 82
Hi Folks -

I have the below code in a Codeunit

Variable declaration
FileName Text
Instr Instream
Downloaded Boolean
Reportoutput BLOB

FileName := 'C:\temp\Salesquote.PDF';
Downloaded := DOWNLOADFROMSTREAM(Instr,",'','',FileName);

My question is in the DOWNLOADFROMSTREAM function I have assigned it to Downloaded a Boolean variable for the return value and when I run my codeunit it prompts me the file Salesquote.PDF and prompts me to Save, Open or Cancel.

Is there any way I can save the content of the Reportoutput Blob field content directly to C:\temp\salesquote.pdf without getting a prompt for my input.

Any help is highly appreciated.



  • Options
    CharlesZACharlesZA Member Posts: 10

    I would use Codeunit419 File Management's BLOBExport function to perform this.
    Life runs on code;
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690

    You need to pass a special parameter to DOWNLOADFROMSTREAM function to make it stop showing the dialog and asking the user for an action.

    Look into the codeunit 419, search for Magicpath, and see how it is used.

    But indeed it would be probably easier for you to use a function from C419, like BLOBExportToServerFile, to do the job for you.

    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    RockWithNAVRockWithNAV Member Posts: 1,139
    In support with all other member, I will just ass one thing like whenever you have to perform stuffs and operations like this then you should always go through File management codeunit, It has everything and probably you dont have to write any custom codes, OR better its the best place to even seek for any help.
Sign In or Register to comment.