How Can I Use PowerShell to Upload Files to SharePoint Folders?

0
11
Asked By TechieTurtle92 On

I'm looking for assistance with a PowerShell script to upload a specific file to over 80 folders on SharePoint, all located within a single parent folder. I've successfully done this with files on my local drive before, but I'm having trouble with the PnP Module for SharePoint now. I used to have a solution that was pretty straightforward, like changing the site URL, but it doesn't seem to work this time. I've heard the PnP module might have new requirements since Microsoft shifted to a single tenant app model. Can anyone share their experience or offer a workaround for this issue? I've pasted my script below for reference, though I am relatively new to PowerShell and most of it was generated with CoPilot. Thanks for your help!

4 Answers

Answered By ConcernedUser34 On

Just a heads up – be cautious with scripts that have the potential to modify a lot of files and folders! It's great you want to automate tasks, but reaching out to your IT team might save you some headaches. They could do it for you or at least guide how to do it without risking your job.

Answered By ResourcefulRanger21 On

If you want to stick with PowerShell, try the simpler method of just syncing your SharePoint folder with OneDrive. Upload your file to OneDrive and let Sync do the heavy lifting to SharePoint. This might be your best bet without getting too involved with PnP.

Answered By CleverCoder50 On

It sounds like you might be running into some of the limitations introduced by Microsoft's new policies for the PnP module. From what I've gathered, you now need to register your own application in Azure and use specific client IDs to authenticate your connections. I would recommend looking into Power Automate as an alternative; it's much easier for this kind of bulk operation and integrates well with SharePoint itself.

Answered By InnovativeThinker88 On

You're definitely not alone in this! The recent changes requiring app registrations can be a hassle. Besides using Power Automate, make sure you check with your IT team; they might be able to help you set up the required applications or provide guidance. Trying to use PnP power commands without proper privileges could lead to issues.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.