OBJECT Codeunit 50001 Download File from URL { OBJECT-PROPERTIES { Date=28/11/20; Time=23:02:06; Modified=Yes; Version List=DL FILE; } PROPERTIES { OnRun=BEGIN END; } CODE { VAR Client@1000000000 : Boolean; PROCEDURE DownLoadFile@1000000012(URL@1000000000 : Text[1024];FileName@1000000008 : Text[1024]); VAR XmlHttp@1000000003 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 6.0:{88D96A0B-F192-11D4-A65F-0040963251E5}:'Microsoft XML, v6.0'.ServerXMLHTTP60"; InStr@1000000001 : InStream; OutStr@1000000007 : OutStream; CompInf@1000000002 : TEMPORARY Record 79; BEGIN IF ISCLEAR(XmlHttp) THEN CREATE(XmlHttp, FALSE, NOT ISSERVICETIER); XmlHttp.open('GET', URL,0); XmlHttp.setTimeouts(10000,10000,10000,100000); XmlHttp.send(''); IF XmlHttp.status = 200 THEN BEGIN InStr := XmlHttp.responseStream; CompInf.Picture.CREATEOUTSTREAM(OutStr); IF COPYSTREAM(OutStr, InStr) THEN CompInf.Picture.EXPORT(FileName); END; CLEAR(XmlHttp); END; BEGIN END. } }
Answers
Can you use automation variable with create(automation,true,true.
Hope this can help you
You can use something like this:
Regards