Hello,
How can we use this option which is in SharePoint Online UI (share everything in this folder, even with unique permissions) with pnp powershell?

Hello,
How can we use this option which is in SharePoint Online UI (share everything in this folder, even with unique permissions) with pnp powershell?

Hello @ChandraKishoreBodduru-4014 ,
Welcome to Q&A Forum!
Please run the below PNP PowerShell as an admin:
#Config Variables
$SiteURL = "https://tenant.sharepoint.com/sites/sitename"
$ListName ="listname"
$FolderServerRelativeURL = "/Sites/sitename/listname/foldername"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -UseWebLogin
#Set folder permissions - Add User
Set-PnPfolderPermission -List $ListName -identity $FolderServerRelativeURL -User "username@tenant.onmicrosoft.com" -AddRole "Edit"


Thanks,
Echo Du
==============================
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
@EchoDu-MSFT Thank you for reverting. Small correction in my question.
Corrected Question: How to add permissions to all sub folders (Having unique permissions) under a top level folder having unique permissions using pnp powershell without looping through all sub folders?
I have a solution that loops through all the subfolders and adds the permissions. But we are dealing with thousands of folders and this is a time taking process. I saw an option in SP Online UI saying "share everything in this folder, even with unique permissions."
I'm looking if there is a way to use this in powershell so that without looping through all the sub folders under a folder we can add the permissions.
Thank you,
Chandra Kishore
Hi @ChandraKishoreBodduru-4014 ,
Thanks for your reply.
Based on my research, there is no way to meet your design through PNP PowerShell.
You can see the "Sharing SharePoint folder items with unique permissions" to learn more information.
Thanks,
Echo Du
Hi @ChandraKishoreBodduru-4014 ,
Is there anything else I can help with regarding this issue?
You can comment us at any time and we will continue to follow up.
Thanks,
Echo Du
11 people are following this question.