Closed kgr7 closed 3 months ago
@kgr7 : a Folder is nothing more than an List Item and we do support breaking permission inheritance for list items (see https://pnp.github.io/pnpcore/using-the-sdk/security-intro.html#breaking-permission-inheritance). Something like below snippet should work:
var source = await context.Web.GetFolderByServerRelativeUrlAsync(folder.ServerRelativeUrl, x => x.ItemCount, x => x.Folders, x => x.Files, x => x.ListItemAllFields);
await source.ListItemAllFields.BreakRoleInheritanceAsync(false, true);
@kgr7 : did the above help?
@kgr7 : did the above help?
Sorry I forgot to reply! Yes it did help thank you this is what I was looking for 🙂
Category
Describe the feature
As a SharePoint admin I can break permission inheritance and define a specific audience and permissions for any given folder in a document library. As far as I can see, this is not possible to do currently with PnP Core. It can be done for Lists but seemingly not folders.
I was wondering if there is some technical reason this isn't supported or if it has simply not been added yet. It would really help my project as we are trying to automate provisioning of sites, documents and folders.
Describe the solution you'd like
Ideally, I think I would like Folders to behave similarly to Lists which would offer more granular permission/audience control and an alternative to creating a whole other new document library.