Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 7025

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 2162

Deprecated: Hook imagify_allow_picture_tags_for_webp is deprecated since version 2.2! Use imagify_allow_picture_tags_for_nextgen instead. in /www/collab365_296/public/wp-includes/functions.php on line 5758
How to manage permissions on a SharePoint List Item using Microsoft Flow – Add Contribute permission - Collab365
Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Warning: Undefined array key "url" in /www/collab365_296/public/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/smart-site/classes/class-tvd-smart-shortcodes.php on line 85

2018-07-25

Fibonacci Elephant logo with Microsoft's Flow logo

This post describes how to add contribute permission for a selected user id to a single item in a list using Microsoft Flow. The flow uses the REST API calls to change the permissions. The walk through uses a custom list with one columns added, Requester which is a Person column.

In Part 1 of this series we broke the inheritance on an item when is was created with our 5 step flow, which created a few variables and then used a HTTP Request to SharePoint using REST API to break the inheritance.

5 step flow from part 1

Using the above flow as a starting point we will continue.

  1. Before we can give a permission level to a person we need to know their Id on this tenancy. This can be fetched using another HTTP Request using REST. The syntax for this is
    _api/web/SiteUsers/getByEmail('name@company.com')

    So using the Requester property of email address we update the URI-String variable and use it in with a GET method in the HTTP request.

    Updating URI-String and sending HTTP Request

  2. The previous step will return the data structured and we need to use the body expression to retrieve it. To make this easy I recommend you rename the step to a simple name, e.g. GetRequestorID
  3. Then add a step to initialise a variable to store the Requester’s ID. In the Value box click on Expression in the Dynamic content and enter in the following and click OK.
    Details of the expression being editedBe aware once you save and close the Flow the details of the expression entered will not be obvious. So to help debug the code later I add a comment of the formula to the step.
  4. The next step is to construct the URI-String needed to give the Requester Contribute permission. The Contribute permission has an ID of 1073741827. In a future post we will look up the ID for the requested permission level by name.The syntax to change the permission is
    _api/lists/getByTitle('MyList')/items(1)/roleassignments/addroleassignment(principalid=12,roledefid=1073741827)

    So we Set the URI-String to the new request and send it as a HTTP request to SharePoint as a POST method.

    Update URI-String to give Contribute permission

  5. Save and create a new item in the list. Then look at the permissions for the new item and you will see it has unique permissions and you have full control and the Requester has Contribute permission.
    Updated Item permissions

Resources

As always we all learn from each other and I am grateful to the resources provided online. Here are the ones that helped me create this series.

“How to manage permissions on a SharePoint List Item using Microsoft Flow! – Series Navigator:

 

(Visited 3,666 times, 1 visits today)

About the author 

Laura Graham-Brown

SharePoint Trainer, Consultant and Agony Aunt

Summit Bundle

Get 200+ hours of Microsoft 365 Training for 27$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos and 108 Ebooks in the Collab365 Academy. This offer is insane and is only available for a limited period.