Having trouble with adding or removing Role Assignments on SharePoint document folders using REST API through Power Automate.
Process is to copy a Template folder with subfolders. Of which, 2 subfolders need unique permissions to prevent unwanted user access.
I believe BreakRoleInheritance
is being broken properly prior
Sent POST via Send HTTP request via SharePoint:
_api/web/GetFolderByServerRelativeUrl('Shared Documents/SHOW FOLDERS/2017 Budgets/01 January/SHOW20')/ListItemAllFields/breakroleinheritance(copyRoleAssignments=true,clearSubscopes=true)
Sample command sending DELETE via HTTP to remove a SP Group with ID of (6) from folder:
_api/web/GetFolderByServerRelativeUrl(‘Shared Documents/SHOW FOLDERS/2017 Budgets/01 January/SHOW20')/ListItemAllFields/roleassignments/getbyprincipalid(6)
Error output:
{
"status": 400,
"message": "The expression \"web/GetFolderByServerRelativeUrl(‘Shared Documents/SHOW FOLDERS/2017 Budgets/01 January/SHOW20')/ListItemAllFields/roleassignments/getbyprincipalid(6)\" is not valid.\r\nclientRequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\r\nserviceRequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",
"source": "https://xxxxxxxxx.sharepoint.com/sites/FILETRANSFER/_api/web/GetFolderByServerRelativeUrl(%E2%80%98Shared%20Documents/SHOW%20FOLDERS/2017%20Budgets/01%20January/SHOW20')/ListItemAllFields/roleassignments/getbyprincipalid(6)",
"errors": [
"-1",
"Microsoft.SharePoint.Client.InvalidClientQueryException"
]
}