Removing Item Permission Using SharePoint Workflow And REST API


In a previous article, we saw "Breaking Item Permission Inheritance Using SharePoint Workflow And REST API" but what if the existing permissions are applied to the item already?

Now, I’m going to use SharePoint REST APIs to read all roles and permissions and then remove all the existing permissions to replace them with the new permission levels. 

SharePoint Designer Workflow 2013 to remove item permissions

Step 1

Create the variable JSONRequestHeader as a dictionary for setting a service call header to get all roles and assignments to the item.


Step 2

Create the variable readRolesApiUrl as a string to set the service URL.


Step 3

Then, call the service to get all roles to the item.


Step 4

Read all responses from the result and set it to the AllRoles variable.


Step 5

Get all counts of the data in AllRoles variable to loop through all the roles assigned.


Step 6

Create the index variable as an integer and set it as 0.


Step 7

Create the variable JSONDeleteHeader as a dictionary to set as a header for deleting the service call.


Step 8

Create the loop that runs repeatedly while Index is less than countRoles.


Step 9

Get the individual item and then get the principle id to remove the permission.


Step 10

Create the RoleAssignment delete API URL using string builder.


Step 11

Call the service to delete the permission of the particular principle ID (Group or User ID).


Step 12

Increment the value of the index. The loop will continue repeatedly till the condition fails.


That's it. Your old permissions are deleted successfully. In the next article, we will see how to add new permissions to the current item.



In this article, we have explored how to remove all permissions of the item by using SharePoint Workflow 2013 and REST API.