Skip to content

Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Problems
  • Triggers
  • Application specific solutions
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
Menu

How to assign custom SharePoint permission level with Power Automate

Posted on June 19, 2022June 19, 2022 by Tom

“I created my own permission level in SharePoint ‘Contribute without Delete’, how can I assign these custom permissions to users in a Power Automate flow?”


The most direct Power Automate action to assign SharePoint permissions is the ‘Grant access to an item or a folder’. You select the site, list/library, item/file, user, and the permission level, and flow will do the rest. But the roles in this action are very limited. You can add only two permission levels: ‘Can edit’ giving user the ‘Contribute’ permission level, or ‘Can view’ to assign ‘Read’ permissions.

Power Automate custom SharePoint permission

But what about the other permission levels? Let it be the default ones, e.g. Full Control, or custom ones, e.g. Contribute without Delete? What custom value does the action expect in the Roles field?

You’ll need the permission level id

If you select one of the available roles and use the ‘Peek code’ functionality, you’ll see what’s happens behind the choice field. The action replaces the ‘Can edit’ or ‘Can view’ with a string in format:

role:<permission level id>

That’s what the action expects as a custom value. Therefore, if you want to add different permissions than ‘Contribute’ or ‘Read’, you can add them using the same string.

Get the permission level with an HTTP request

The permission level id is accessible only via an HTTP request to SharePoint. Add the ‘Send an HTTP request to SharePoint’ action with the configuration below.

Method: GET

Uri:
_api/web/roledefinitions/GetByName('<permission level name>')

Note: <…> is a placeholder, replace it including the < and >.

The request will check all permission levels on the site, and return only the one with the specified name. In this example it’s the ‘Contribute wo Delete’ permission level.

Extract the permission level id from the outputs JSON and use it to grant the permissions.

body('Send_an_HTTP_request_to_SharePoint')?['d']?['Id']
Power Automate custom SharePoint permission

Summary

The new Power Automate actions expect that you’ll work only with two permission levels in SharePoint – ‘Read’ or ‘Contribute’, ignoring the the other default levels as well as the custom ones. But if you know the permission level id you can use it, let it be using the ‘Grant access…’ action or with an HTTP request.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Now available:

The Ultimate Power Automate expressions cheat sheet
Equip yourself with the tool to translate your thoughts into Power Automate expressions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Format results of date calculation in SharePoint columnJune 29, 2022
  • Why is your Power Automate flow creating duplicatesJune 26, 2022
  • How to create a unique identifier in your Power Automate flowJune 22, 2022
  • How to assign custom SharePoint permission level with Power AutomateJune 19, 2022
  • Remove permissions from a specific SharePoint user with Power AutomateJune 15, 2022

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

© 2022 Let's POWER Automate | Powered by Superbs Personal Blog theme