Forum Discussion
youssefch
Jun 29, 2019Copper Contributor
Add-PnPFile : Access denied. You do not have permission to perform this action or access this resour
I am trying to upload a file (actually copy a file from a local machine) to folder in OneDrive for Business $UserName="user@domain" $pwd ="StrongPassword" $SiteUrl = "" $encpassword = conver...
Toby Statham
Jul 05, 2019Brass Contributor
youssefch You will still need to add yourself as a Site Collection Administrator to the user's Personal Site
Connect to the tenant admin site and add the user as a site collection admin
Set-SPOUser -Site $PersonalSiteUrl -LoginName $AccountRunningScript -IsSiteCollectionAdmin $true
Then you should be able to connect and add the file. You will want to remove the user afterwards