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.


1 Answer 1


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"
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 and acknowledge you have read our privacy policy.

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