Is there any quick way how to manage access for multiple folders in same library at once?

Christopher Charles 0 Reputation points
2024-06-25T10:24:22.1933333+00:00

Is there any quick way how to manage access for multiple folders in same library at once?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,130 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,777 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 43,421 Reputation points Microsoft Vendor
    2024-06-26T06:20:59.9033333+00:00

    1.Create a csv file as following picture show.1

    2.Run following PowerShell as administrator to set permissions for folder.

    $SiteURL = "https://tenant.sharepoint.com/sites/emily"
    $Documentlibrary = "doc"
    $CSVFile = "C:\Users\spsetup\Desktop\pnp.csv"
    Connect-PnPOnline -Url $SiteURL -Interactive
     
    $CSVData = Import-CSV $CSVFile
    ForEach($Row in $CSVData)
    {
         #Get the user
         $Users = $Row.User
         ForEach($User in $Users)
         {     
               Set-PnPfolderPermission -List $Documentlibrary -identity $Row.FolderServerRelativeURL -User $User -AddRole $Row.Permission
                
         }
    }
    

    3.Result:

    enter image description here

    enter image description here


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.