silent_waters Posted November 5, 2018 Share Posted November 5, 2018 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 More sharing options...
Nine Posted November 5, 2018 Share Posted November 5, 2018 Any way we can get a script that can be run ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Danp2 Posted November 5, 2018 Share Posted November 5, 2018 Pretty sure this is due to not being logged in. I get similar behavior on this end -- Download works in Firefox where the login has already occurred Download fails in Chrome, prompting for user account With InetGet / InetGetInfo, I get the same results as you Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
silent_waters Posted November 10, 2018 Author Share Posted November 10, 2018 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now