Add New Item Permission Using SharePoint Workflow And REST API

In this article, I explain about how we remove item permissions, now I’m going to explain how to add a new permission to the item using SharePoint REST API and SharePoint Designer Workflow 2013.

Introduction

In the existing article, we are removing the item permissions that are available from inheritance.

Now I’m going to use SharePoint REST APIs to add new item permission levels to the item based on the users with their principle id and role id. 

SharePoint Designer Workflow 2013 to add new item permissions

Step 1

Create or update workflow that should add a new permission level to the current item against any user based on user's principle id, for example, I’m going to add a new permission modified by the user.

Step 2

And I’m going to create a new variable for the add roles Rest API URL.

SharePoint

Step 3

The variable should be the string value and now I've created the variable named “addrolesApiUrl”.

SharePoint

Step 4

We need to find which level of permission will apply to the users who have new permission on the current item. For example, below are mentioned some of the permission levels with its corresponding role ID.

Permissions level Role ID
Full Control1073741829
Contribute1073741827
Read1073741826

Step 5

Now, I’m going to set the permission read for the modified user, I have set the value for the API URL variable with Addrolesandassignments method in list item API,

SharePoint

Step 6

Then call the service to add a new role to the user for the current item.

SharePoint

Step 7

After successful service call response, the user will have the new level of permission.

References

https://msdn.microsoft.com/en-in/library/office/dn531432.aspx#bk_RoleAssignmentCollectionAddRoleAssignment

Summary

In this article, we have explored how to add new permission level to the user for the current item by using SharePoint Workflow 2013 and REST API.