I have a few files on my team's SharePoint site (in Office 365) that are shared with a public link--anyone with the link can view. For several months, I have had a process that uses PowerShell's DownloadFile() function to save these files to users' local C:\ drives.
Sometime this week (or perhaps last), SharePoint has started returning a 500 Internal Server Error message. The share links follow this format:
https://mycompany.sharepoint.com/sites/mypath/mypath/myteam/_layouts/15/download.aspx?docid=bunchofrandomcharacters&authkey=bunchofrandomcharacters I can put the share links into both the IE and Chrome web browsers and the files download as expected, so apparently nothing has changed with the shares' availability. (Firefox returns a "Server Error in '/' Application" message, but I don't know if it would have worked before this.)
Why would DownloadFile() be different suddenly? And more importantly, is there a way to fix it?
Thanks, Jacob
edit: here's the complete error message from the PowerShell command prompt in case it's useful:
Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (500) Internal Server Error." At line:1 char:1 + (New-Object Net.WebClient).DownloadFile('https://mycompany ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : WebException