Jump to content

Inetget error 13 on simple download


Recommended Posts

I am trying to download an xlsx file from SharePoint online. The file is available to anyone with the link. The link is in this format (amended for security): 

https://xxxx.sharepoint.com//_layouts/15/download.aspx?SourceUrl=%2FShared Documents%2FProjects%2FProject%2FTask List.xlsx

If I paste the link into any browser on any computer it immediately starts a download of the file, no sign-in, no problem. However when I do this:

Local $hDownload = InetGet($sURL, $sWorkingDir & "\Test.xlsx",1,1)
    Do
        Sleep(250)
    Until InetGetInfo($hDownload, 2)
    Local $aData = InetGetInfo($hDownload)

_ArrayDisplay($aData)

I get error code 13 (extended code 0) in $aData and no downloaded file. Downloadcomplete is set to true, Downloadsuccess is set to false. This code works fine for other URLs, just doesn't seem to like this one. 

I've tried every combination of inetget parameters, including waiting for the download to complete instead of a background download, always the same error. 

I've scoured the web and can't find any useful information about the error codes from inetget or any details of how to fix this.

I can get it to work by calling IE with the URL of the file as a parameter thus:

Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE -new " & $sUrl)

...and then automating the download with send(), but that's ugly and  likely to be troublesome when run on other computers, so I really don't want to have to go that route. 

Any pointers or alternative ways to download a file in the background would be very welcome.

Link to comment
Share on other sites

Seem to have got it working, but not sure if that is the same as solving it. 

I've used the public link instead of the one above, and replaced everything after the last '?' with 'download=1'. That allows InetGet to download it. 

Still don't really understand why the link above doesn't work. @Danp2, I forced a logoff and cleared out the cache and the link still worked when I pasted it into the browser, and said 'Guest Contributor' in the top right corner where my username would appear if I was logged in. Just wouldn't work with iNetGet. 

Anyway, it's working with the reformatted public link. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...