pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
684 stars 349 forks source link

[BUG] Get-PnPProperty for folder permissions is failing #4506

Closed margeh closed 2 weeks ago

margeh commented 2 weeks ago

Reporting an Issue or Missing Feature

Hi guys, is there a change how you can retrieve folder permissions? We are using an Azure function running PowerShell and using PnP in Version 2.4.0

In the past we were able to retrive the permissions with the Cmdlets:

$SPFolder = Get-PnPFolder -Url $subfolderServerRelativeURL Get-PnPProperty -ClientObject ($SPFolder.ListItemAllFields) -Property HasUniqueRoleAssignments, RoleAssignments

Since the object $SPFolder.ListItemAllFields.HasUniqueRoleAssignments is retrievable and filled with a value, the object $SPFolder.ListItemAllFields.RoleAssignments is not and this error message is presented:

Expected behavior

List of permissions for folder is retrieved.

Actual behavior

format-default : The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.

Steps to reproduce behavior

$SPFolder = Get-PnPFolder -Url $subfolderServerRelativeURL Get-PnPProperty -ClientObject ($SPFolder.ListItemAllFields) -Property HasUniqueRoleAssignments, RoleAssignments

What is the version of the Cmdlet module you are running?

2.4.0

Which operating system/environment are you running PnP PowerShell on?