5

I'm trying to use the Load-CSOMProperties.ps1 made by Gary Lapointe to report me if a folder "HasUniqueRoleAssignments". This is working fine for webs and lists but it doesn't seem to work for folders.

Load-CSOMProperties : Instance property 'HasUniqueRoleAssignments' is not defined for type Microsoft.SharePoint.Client.Folder At E:\OneDrive\Powershell\CSOM\DoStuff.ps1:108 char:9 + Load-CSOMProperties -object $folder -propertyNames @("HasUniq ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Load-CSOMProperties

Anyone has an example on how to do this?

1

You need to get the folders "item" before making the call. E.g.

$ctx.Load($folder)
$ctx.ExecuteQuery()

$item = $folder.ListItemAllFields;
Load-CSOMProperties -object $item -propertyNames @("HasUniqueRoleAssignments");

Also note that the same is true for Microsoft.SharePoint.Client.File Call the ListItemAllFields property same as with a folder.

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.