I have been trying to see the rights on folders within a sharepoint list. I haven't been able to do so with Powershell.

Is there a way to do it with Python? I need all the rights on all folders. So we need to know which person has which rights on which folder.

I hope the question is clear


Use PNP module and cmds:

  1. Use Get-PNPfolder documentation here, Get-PNPlist documentation here, with -Includes RoleAssignments
  2. example here

Here is script:

Connect-PnPOnline -Url https://kpcs.sharepoint.com/sites/zvi
$context = Get-PnPContext
$folder = Get-PnPFolder -Url "/sites/zvi/Shared Documents/test" -Includes ListItemAllFields.RoleAssignments, ListItemAllFields.HasUniqueRoleAssignments

if($folder.ListItemAllFields.HasUniqueRoleAssignments -eq $True) 
    foreach($roleAssignments in $folder.ListItemAllFields.RoleAssignments)
        Get-PnPProperty -ClientObject $roleAssignments -Property RoleDefinitionBindings, Member

        Write-Host $roleAssignments.Member.LoginName","$roleAssignments.Member.Title","$roleAssignments.Member.PrincipalType.ToString()","$roleAssignments.RoleDefinitionBindings[0].Name


enter image description here

Hope it helps!

  • We have tried the get-pnpfolder command but we did not succeed. Do we need to combine get-pnplist with get-pnpfolder? – Pierre Mar 5 at 10:13
  • Get-PnPProperty : Cannot bind parameter 'ClientObject'. Cannot convert the "$folderitems" value of type "System.String" to type "Microsoft.SharePoint.Client.ClientObject". At line:1 char:16 + $folderitems | Get-PnPProperty + ~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-PnPProperty], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,SharePointPnP.PowerShell.Commands.Base.EnsureProperty This is the error i am getting – Pierre Mar 5 at 10:30
  • It points to Get-PnPFolder what we have tried and didn't get us anything. And I can't get get-childitem of resolve-pnpfolder. I don't know what parameters i need to get rights of the folders. – Pierre Mar 5 at 13:05
  • i will do this script tomorrow. – Zdeněk Vinduška Mar 5 at 15:04

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.