Ranjith kumar

Delete Existing & Add New Permission to the Library/List

Blog Post created by Ranjith kumar on Apr 4, 2018

By default, all sites, lists, and libraries in a site collection inherit permissions settings from the site that is directly above them in the site hierarchy.
This means a site inherits permissions from the root site of the site collection, and a sub site inherits permissions from its parent site. Folders,
lists and documents inherit permissions from the site that contains them, and so on.
To assign unique permissions to a list, library, or survey, you have to first break permissions inheritance, then assign unique permissions.

 

 

1)Break Inheritance

2)Delete Existing Permissions(optional, based on your Project Recruitment you can decide this step)

3)Add New Permission 

 

1) Break Inheritance 

 

 

 

 

{Workflow Context:Current site URL}_api/web/lists/getByTitle('{Variable:ListName}')/breakroleinheritance(copyRoleAssignments=true, clearSubscopes=true)

 

 

 

2)Delete Exiting Permissions 

 

To delete Permission {Workflow Context:Current site URL}_api/web/lists/getbytitle('LISTNAME')/roleassignments({Variable:PrinscipleGroupID}) you can use this Rest api, To delete group you have to get the Principle Group id first 

To get Principle group id you can use following REST api

Siturl/_api/web /sitegroups 

 

 

 

 

{Workflow Context:Current site URL}_api/web/lists/getbytitle('LISTNAME')/roleassignments({Variable:PrinscipleGroupID})

 

 

3) Add Permission

 

There are two parameters values we need to ADD PERMISSION
Principalgroupid
roledefinitionsid

 

to get these you can you below REST API 

Siturl/_api/web /sitegroups 

SiteURL/_api/web/roledefinitions

 

 

 

 

END,Good luck.

Outcomes