If you need to set unique permissions on a single list item or document in a SharePoint list, you can do that using a skybow Triggered Action.
Configure the following steps to set them dynamically via the SharePoint REST API:
- Login to skybow Solution Studio https://solutions.skybow.com
- Create a new solution or open your existing solution
- Click on the list in the left tree (Solution Elements) -> Things in background -> Triggered Actions
- Add a new triggered action, give it an appropriate title and click next
- Choose your trigger e.g. Item Added and click next
- Choose the action type HTTP Request and configure the first action to remove all the permissions from the newly created item
Type: HTTP Request
Url: [[@Web.Url]]/_api/lists/getByTitle('My List')/items([[ID]])/breakroleinheritance(copyRoleAssignments=false,clearSubscopes=true)
Request Type: POST
Headers: Accept application/json;odata=nometadata - Add another action of type HTTP Request to add e.g. contribute permissions to the author
Type: HTTP Request
Url: [[@Web.Url]]/_api/lists/getByTitle('My List')/items([[ID]])/roleassignments/addroleassignment(principalid='[[Author.Id]]',roleDefId=1073741827)
Request Type: POST
Headers: Accept application/json;odata=nometadata
Hint: You can find a list of standard Role Definition IDs here: (those are everywhere the same, on SharePoint Server but also on SharePoint Online)
https://www.c-sharpcorner.com/article/get-sharepoint-role-definition-ids/ - Save it and add a new item to the list to test it
Note that it will take a couple of seconds for the permissions to be applied, as skybow Triggered Actions are executed asynchronously in the background.
Warning: Be aware that too many permission breaks can dramatically slow down the performance of your SharePoint Site. Please stick to the official SharePoint limits by Microsoft.