Using Powershell PnP to create and permission multiple folders in Office 365
Let’s imagine, you have a CSV file with names and email addresses. You need to create a large quantity of folders, each folder must have a specific name and be uniquely permissioned to different users based off the CSV.
All of this you can do with PowerShell.
- Make sure PnP PowerShell is installed, just run the command Get-Command -Module *PnP*
- Make sure you have a CSV file with the following headers and the relevant information:
3. You need to fill in 4 variables in the script:
- The site URL that you want to carry out the work on
- The name of the list or library the folders will be created in
- The level of access you want to give to the user (read, contribute etc)
- The path to the CSV file – ensure the csv file is called Folders so Folders.csv
- Run the script:
If you don’t want to have full control to the folder, just change this:
Remember to change YOURACCOUNT to your account email that you are running the script with: