1

I have a library with unique permissions on specific documents which were created by sharing those documents.

I have a SP group which I want to grant it a unique permission to each one of these documents.

I'm looking for a PowerShell solution as I can't grant permission to each one by its own as it will take a lot of time.

Thanks

0

You can save the relevant document ID as a CSV file and use PnP PowerShell command to set item permission for these documents:

enter image description here

$SiteURL = "https://domain.sharepoint.com/sites/sitename"
$ListName ="LibraryName"
$GroupName="SPGroupName"
Connect-PnPOnline -URL $SiteURL
Import-Csv -Path C:\itemid.csv | ForEach-Object {  
  $ListItemID = $_.ListItemID
  $Group = Get-PnPGroup | where-Object {$_.Title -eq $GroupName}
  Set-PnPListItemPermission -Identity $ListItemID -List $ListName -AddRole "Full Control" -Group $Group
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.