Looking for Unique permissions

%3CLINGO-SUB%20id%3D%22lingo-sub-50327%22%20slang%3D%22en-US%22%3ELooking%20for%20Unique%20permissions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-50327%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20any%20feature%20on%20the%20CSOM%20API%2C%20or%20any%20other%20to%20check%20if%20an%20element%20(Site%2FWeb%2FFolder)%20have%20child%20items%20with%20unique%20permission%20underneath%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20dont%20want%20do%20a%20an%20expensive%20operation%20going%20deep%20into%20the%20childs%2C%20but%20I%20see%20the%20info%20exposed%20on%20the%20SP%20UI%20when%20you%20add%2Fremove%20permissions%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20info%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-50408%22%20slang%3D%22en-US%22%3ERe%3A%20Looking%20for%20Unique%20permissions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-50408%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F12915%22%20target%3D%22_blank%22%3E%40Raul%20Garita%3C%2FA%3E%26nbsp%3Bthis%20function%20does%3A%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22p1%22%3EGet%20all%20unique%20role%20assignments%20for%20a%20web%20object%20and%20all%20its%20descendents%20down%20to%20document%20or%20list%20item%20level.%3C%2FP%3E%3CP%20class%3D%22p1%22%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-50399%22%20slang%3D%22en-US%22%3ERe%3A%20Looking%20for%20Unique%20permissions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-50399%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Paul%2C%20I'm%20not%20sure%2C%20if%20it%20goes%20to%20all%20the%20childs.%20But%26nbsp%3B%20I%20also%20found%20the%20following%26nbsp%3Bextension%20on%20the%20PnP-sites-core%20library.%20Ill%20check%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3EGetAllUniqueRoleAssignments%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-50378%22%20slang%3D%22en-US%22%3ERe%3A%20Looking%20for%20Unique%20permissions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-50378%22%20slang%3D%22en-US%22%3E%3CP%3EListItems%2C%20Lists%20and%20Sites%20all%20inherit%20from%20SecurableObject%20which%20has%20a%20property%20%22HasUniqueRoleAssignments%22.%20As%20far%20as%20I%20know%20the%20only%20way%20for%20you%20to%20check%20if%20any%20of%20the%20child%20items%20of%20a%20SecurableObject%20has%20unique%20permissions%20applied%20is%20to%20pick%20a%20parent%20(List%20or%20Site)%20and%20loop%20through%20its%20children%20and%20for%20each%20one%20of%20them%20check%20the%20property.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2FEN-US%2Flibrary%2Fmicrosoft.sharepoint.client.securableobject.hasuniqueroleassignments.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmsdn.microsoft.com%2FEN-US%2Flibrary%2Fmicrosoft.sharepoint.client.securableobject.hasuniqueroleassignments.aspx%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Is there any feature on the CSOM API, or any other to check if an element (Site/Web/Folder) have child items with unique permission underneath it.

 

I dont want do a an expensive operation going deep into the childs, but I see the info exposed on the SP UI when you add/remove permissions

 

Any info?

3 Replies
Highlighted

ListItems, Lists and Sites all inherit from SecurableObject which has a property "HasUniqueRoleAssignments". As far as I know the only way for you to check if any of the child items of a SecurableObject has unique permissions applied is to pick a parent (List or Site) and loop through its children and for each one of them check the property.

 

https://msdn.microsoft.com/EN-US/library/microsoft.sharepoint.client.securableobject.hasuniqueroleas...

 

 

Thanks Paul, I'm not sure, if it goes to all the childs. But  I also found the following extension on the PnP-sites-core library. Ill check

 

 

GetAllUniqueRoleAssignments

 

 

Highlighted

@Raul Garita this function does: 

Get all unique role assignments for a web object and all its descendents down to document or list item level.