Forum Discussion
Aron1560
Aug 09, 2023Copper Contributor
Error when using script to download all documents from a SharePoint online document library
Hi everyone, I'm using the following script to try to download all files from a document library:
Function Download-AllFilesFromLibrary()
{
param
(
[Parameter(Mandatory=$true)...
LainRobertson
Oct 23, 2023Silver Contributor
I don't work with SharePoint, but I can see two things of importance:
- The PnP module effectively isn't being used because the .NET classes are being used directly (i.e. the various Connect-PnPOnline statements achieve nothing as no further PnP commandlets are being called);
- $Ctx.Credentials on line 67 is being set to $null, since $Credentials is a non-existent variable (given it's commented out earlier on line 61).
I'd expect point 2 relates directly to the HTTP 403, while point 1 is just an observation.
Cheers,
Lain