Unlocking SharePoint Permissions with Power Automate

Posted by

Today, we’re addressing a common scenario faced by many users when dealing with folder permissions in SharePoint. Whether you’re a seasoned Power Automate user or just getting started, understanding how to navigate folder permissions efficiently can significantly streamline your workflows.

In SharePoint environments, managing folder permissions can sometimes be a complex task, especially when dealing with scenarios involving unique permissions. To simplify this process, we’ve outlined two key approaches that you can leverage within Power Automate to handle folder permissions effectively.

Scenario 1: Standard Folder Permissions

If your folder utilizes standard permissions, accessing a list of users with permissions is straightforward. Using the REST API call below within Power Automate retrieves all users with access to the folder, allowing you to create an HTML table for easy visualization:

Uri: _api/web/siteusers
Method: GET
Headers: 
{
  "Accept": "application/json;odata=verbose"
}

Scenario 2: Unique Folder Permissions

For folders with unique permissions, the process becomes slightly more intricate. In such cases, additional REST API calls might be necessary to check for unique permissions and retrieve user IDs. Below is a simplified demonstration flow:

  1. We start by defining an array that will store the User names
  2. Next, we query the folder to retrieve its permissions using Send HTTP request to SharePoint action. In this example, the folder has an ID of 96. If you’re unsure of the ID, you may need to include an additional step in the process.

Compose 2: Next, the expression below extracts the user IDs with unique permissions.

outputs('Send_an_HTTP_request_to_SharePoint')?['body']?['d']?['SharedWithUsersId']?['results']

We then loop through the array of user IDs returned from SharePoint.

Compose: Returns the item in the array

item()

Send HTTP request to SharePoint 2: Returns the User Details associated with the User Id

Append to array variable: Appends the user titles to an array variable for further processing.

{"Name":"@{outputs('Send_an_HTTP_request_to_SharePoint_2')?['body']?['d']?['Title']}"}

Finally, you can print the array in a user-readable format using a Create HTML Table action

By following these steps, you can seamlessly manage folder permissions in SharePoint using Power Automate, whether they’re standard or unique. These methods not only simplify the process but also enhance the efficiency of your workflows, allowing you to focus on more critical tasks without getting bogged down by administrative overhead.

Stay tuned for more insights and tips on maximizing your productivity with Power Automate and SharePoint!

Leave a Reply

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