Forum Discussion
russell gove
Oct 22, 2017Copper Contributor
Rest property to see if any items in folder have unique permissions
Hi, I'm looking for the property on a list or folder that says if any children have broken inheritance (i.e. if any child items have unique permissions). I know I can do a separate query to find a...
Oct 23, 2017
Hi Russell,
As far as I know, there is no such a property.
If your folder structure is predictable some subsidiary objects' properties can be expanded. Here is the sample in PnP JS Core (as I can recall you use the lib) which represents the idea:
pnp.sp.web.getFolderByServerRelativeUrl(`${_spPageContextInfo.webServerRelativeUrl}/Shared%20Documents`)
.folders
.select('Name,ServerRelativeUrl,ItemCount,Folders/ListItemAllFields/HasUniqueRoleAssignments,Files/ListItemAllFields/HasUniqueRoleAssignments')
.expand('Folders/ListItemAllFields/HasUniqueRoleAssignments,Files/ListItemAllFields/HasUniqueRoleAssignments')
.get()
.then(results => {
return results.map(result => {
return {
...result,
HasUniqueRoleAssignmentsForFolders: result.Folders.results.filter(folder => {
return folder.ListItemAllFields.HasUniqueRoleAssignments;
}).length > 0,
HasUniqueRoleAssignmentsForFiles: result.Files.results.filter(file => {
return file.ListItemAllFields.HasUniqueRoleAssignments;
}).length > 0
}
});
})
.then(results => {
console.log(results);
})
.catch(console.log);Maybe this can be helpful in some way.
Cheers,
Andrew