https - VB6: Downloading files from Sharepoint 365 -
my work migrated sharepoint 2010 sharepoint 365. i've made many tools download files directly sharepoint directories. apparently download code (and other code download online file) no longer works. here's code i've used in past:
function download_file(byval vwebfile string, byval vlocalfile string, lfilesize long) boolean ' code taken from: http://stackoverflow.com/questions/12815142/vba-download-and-save-in-c-user ' on 2013-06-19 dim strheader variant dim oxmlhttp object, long, vff long, oresp() byte on error resume next debug.print "download_file: stage 1" 'you can set ref. microsoft xml, , dim oxmlhttp msxml2.xmlhttp set oxmlhttp = createobject("msxml2.xmlhttp"): me.repaint: debug.print time$: doevents oxmlhttp.open "get", vwebfile, false: me.repaint: debug.print time$: doevents 'open socket website oxmlhttp.send: me.repaint: debug.print time$: doevents 'send request debug.print "download_file: stage 2" 'wait request finish while oxmlhttp.readystate <> 4 doevents loop debug.print "download_file: stage 3" strheader = oxmlhttp.getallresponseheaders if instr(1, strheader, "content-length:") > 1 lfilesize = clng(mid(strheader, instr(1, strheader, "content-length:") + 16, instr(1, strheader, "content-type:") - (instr(1, strheader, "content-length:") + 16))) end if debug.print "download_file: stage 4" oresp = oxmlhttp.responsebody 'returns results byte array debug.print "download_file: stage 5" 'create local file , save results vff = freefile if dir(vlocalfile) <> "" kill vlocalfile open vlocalfile binary #vff put #vff, , oresp close #vff debug.print "download_file: stage 6" 'clear memory set oxmlhttp = nothing debug.print "download_file: stage end" end function the issue i'm able download a file, it's not right size. maybe it's container has correct file name? 1 possible issue we're using secure http while before standard http.
using sharepoint-provided "download link" not work either. 365 issue or https issue?
thanks!
Comments
Post a Comment