Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

How to restore SharePoint item/file permissions (Power Automate)

Posted on October 31, 2021April 12, 2023 by Tom

“I know that Power Automate has an action to break permissions on a file in SharePoint, but how can I reverse it to restore the permission inheritance?”


There’re two standard actions in Power Automate to manage permissions within SharePoint. One is the ‘Stop sharing an item or a file’ that will break permissions inheritance and remove almost all permissions. The second one is the ‘Grant access to an item or a folder’ action to assign specific permissions. Using these actions you can easily manage permission without HTTP requests as already explained.

But there’s another operation that doesn’t have its own action: restoring permissions inheritance. Once there’s no more reason to keep permissions unique, you should always restore their inheritance. One reason is that unique permissions are terrible to manage. The other is that SharePoint has a limit of 50.000 unique permissions, you can’t keep unique permissions for everything.

Restore the permissions inheritance with an HTTP request

Since there’s no direct action to restore the permissions, you must go back to HTTP requests. You’ll need a reverse HTTP request to the one breaking the role inheritance. Instead of BreakRoleInheritance() it must be ResetRoleInheritance().

Method: POST

Uri:
_api/Web/lists/getByTitle('<list name>')/items(<item id>)/ResetRoleInheritance()

Note: < … > are placeholders, replace them including the < and >.

Power Automate restore permissions SharePoint

Such HTTP request will remove all unique permissions from the item and restore the permissions inheritance. It can be used on a SharePoint item, document, or a whole list or a library (if you skip the items() part).

Summary

As many times before, if Power Automate doesn’t give you an action to restore SharePoint permissions directly, you must use an HTTP request. It’s a simple request where all you need is the site address, name of the list/library, and id of the item/file. It’ll remove all unique permissions and reset them back to the parent permissions – let it be a folder, a list or a library.

And if you’re not sure which files/folders have unique permissions, you can list them using another 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.

3 thoughts on “How to restore SharePoint item/file permissions (Power Automate)”

  1. Priya S says:
    April 12, 2023 at 8:40 am

    This one restores the unique permissions at the library level, but if some of the files in the library has unique permissions its not restoring them. How can we achieve this?

    Reply
    1. Tom says:
      May 1, 2023 at 3:27 pm

      Hello Priya,
      you can list all the documents as explained in this article: https://tomriha.com/get-list-of-all-documents-with-unique-permissions-power-automate/ and then restore permissions one by one.

      Reply
  2. Ricardo says:
    May 29, 2023 at 3:23 pm

    what is the minimum privilege you need over an item to successfully execute the call?

    Reply

Leave a Reply Cancel reply

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

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

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.

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with 1000s of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes