Hi @frob ,
After my testing and research, you can manually grant a user "Restricted View" permission in the sharepoint interface.
But you cannot use PnP PowerShell to directly grant users "Restricted View" permissions to folders and files in a SharePoint Online document library. Because the "Restricted View" permission is a hidden permission level as shown below(Not displayed by default in the Permission level).
But you can do that by adding the " Restricted View " permission level (location in the picture above) and then using powershell.
There are steps:
- Library setting-> permission for this document library -> Add " Restricted View " permission level.(You need to Select the permissions to include in this permission level yourself.)
2.Use the following PnP powershell code: $SiteURL = "https://xxxxxxxx" $DocumentName ="xxxx" $UserID="xxx@X .com" #Connect to PnP Online Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential) #Break Permission Inheritance of the List Set-PnPList -Identity $DocumentName -BreakRoleInheritance -CopyRoleAssignments #Grant permission on List to User Set-PnPListPermission -Identity $DocumentName -AddRole " Restricted View " -User $UserID
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.