restsharepoint-onlinepower-automate

Use $batch to bulk break SharePoint List items permission inheritance


I have a list of more than 5000 items in SharePoint. And I would like to bulk break items permission inheritance with their parent site. I have tried to break a single one item permission inheritance by following the this instruction. When I tried to implement this same action getByTitle('*My_List*')/items(261)/breakroleinheritance(copyRoleAssignments=false,clearSubscopes=true) via $batch, it did not work but it also reported no error.

Here is the $batch instruction I followed. And the code below is my API call:

Template1:

--changeset_be8f3abd-b17e-499a-ade8-3e2443be74f3
Content-Type: application/http
Content-Transfer-Encoding: binary

PATCH https://my_site/_api/web/lists/getByTitle('My_list')/items(|ID|)/BreakRoleInheritance(copyRoleAssignments=false,clearSubscopes=true) HTTP/1.1
Content-Type: application/json;odata=verbose
Accept: application/json;odata=nometadata
IF-MATCH: *

enter image description here

Could anyone please help to check what's wrong with my REST API calls for my list? I successfully implemented bulk get, delete, and create list items via $batch REST APIs, but the BreakRole Inheritance is not working.


Solution

  • I know what's the problem. I tried only for one record once I added one more item to manipulate and it was working.