Power Automate error: Cannot find the resource for the request addroleassignhments

In this Power Automate tutorial, we will see how to fix the error ‘Cannot find a resource for the request addroleassignhments‘. Also, we will see how we get this error and how we can fix It.

Recently, when we are creating a SharePoint group using Power Automate rest API from the SharePoint list. After that, we added members and provided permission for that particular SharePoint group.

You can see the below screenshot of the SharePoint list named ‘SharePoint group’:

Cannot find the resource for the request addroleassignhments

We encountered an error while assigning permission: ‘Cannot find the resource for the request addroleassignhments‘.This error states that the API endpoint, we are using does not support the operation we are performing i.e. providing permission to the SharePoint group.

 Error 'Cannot find the resource for the request addroleassignhments' in Power automate

Now we will discuss the solution, and how to solve the error when the resources cannot find for the request addroleassignments.

Cannot find the resource for the request addroleassignhments error in Power automate

Here we are creating an item in the SharePoint list and my SharePoint list contains the below columns:

  • Group Name (Title) -Single line of Text
  • Members: Person
  • Description: Multiple lines of text
  • Group Permission: Choice

Then the flow will trigger every time a new item is created on that list. And then it will perform the below task:

  • Create a SharePoint group: In the below screenshot, you can see after adding the trigger action ‘When an item is created’ we have created a ‘Send an HTTP request to SharePoint’ action. That will create a SharePoint group on the SharePoint site.
Error 'Cannot find the resource for the request addroleassignhments' in Microsoft Power automate
  • Add members to SharePoint group: To add members to the SharePoint group we fetched the group id using Compose action. Then we add members to the group using the group id in the ‘Send an HTTP request to SharePoint’ action. As we are adding multiple members, it will add Apply to each action.
Error 'Cannot find the resource for the request addroleassignhments' in Microsoft Power automate flow
  • Provide Permission to the SharePoint group: To provide permission to the SharePoint group, we need a group id, also a role definition id.
    To get the role definition id, we will ‘ Send an HTTP request to SharePoint’ action. From the output, we will get the role definition id using Compose action.
    Then we will provide the permission to the SharePoint group using ‘Send an HTTP request to SharePoint’
Error 'Cannot find the resource for the request addroleassignhments' in Microsoft flow

However, when we were running this flow, we came across this error- Cannot find the resource for the request addroleassignhments‘ error in Power Automate. You can also refer to the image given below for a detailed error message.

 Error 'Cannot find the resource for the request addroleassignhments' in Power automate

Now, in the next part, we will see how we can solve this error in Power Automate.

See also  How to create a measure in Power BI

Cannot find the resource for the request addroleassignhments error in Power Automate – Solution

Here we will first understand why we are getting an error: Cannot find the resource for the request addroleassignhments in Power Automate.

Now, if you look closely at the last step where we are adding permission to the SharePoint group, we specified below the ‘Uri’ field in the ‘Send an HTTP request to SharePoint’ action.

/_api/web/roleassignments/addroleassignments(principalid=@{outputs('Compose_-group_id')}, roledefId=@{outputs('Compose-role_id_')})
Microsoft Flow Error 'Cannot find the resource for the request addroleassignhments'

Here we provide the method as addroleassignments(), also we are passing two parameters i.e. principalid and roledefId. However, this method and the parameter we passed are not correct.

So it should not be ‘addroleassignments()’, it should be ‘addroleassignment()‘. Additionally, the parameter names principalid and roledefid were changed to principalid and roleDefId, respectively.

So the correct Uri is below:

/_api/web/roleassignments/addroleassignment(principalid=@{outputs('Compose_-group_id')}, roleDefId=@{outputs('Compose-role_id_')})
Cannot find the resource for the request addroleassignhments' in Power Automate

This is how we can fix the error ‘Cannot find the resource for the request addroleassignhments’ in Power Automate’.

Conclusion

In this Power Automate tutorial, we saw how we can fix the error: ‘Cannot find the resource for the request addroleassignhments’ in Power Automate.

You may also like:

>