0

Using SharePoint REST API I can add and remove user permissions for a list item. If I need to add permissions for multiple users to a specific item, is there a way to do this other than looping the post for each one or creating a SP group?

1

I don't know if is it the best way, but I have created a Flow, with HTTP Trigger and input parameters: siteurl, listName, itemId, and an array of user-permisison objects like:

{
  "siteUrl": "https://xxxx.sharepoint.com/site",
  "listName": "Documents",
  "itemId": "1",
  "permissions": [
    {
      "userId": 8,
      "roleDefinitionId": "@{variables('RoleEdit')}"
    },
      "userId": 10,
      "roleDefinitionId": "@{variables('RoleEdit')}"
    },
    {
      "userId": 11,
      "roleDefinitionId": "@{variables('RoleFull')}"
    }
  ]
}

It is easy to reuse in any list with one REST call, but inside the flow I am looping trough the users and set the permissions one by one, because there is no other way with SharePoint REST API.

Hope it helps.

1

I am afraid that there is no way other than looping the post for each one or creating a SharePoint group.

By REST API, it only can add permission for one user by one REST API post.

1

I usually do this with a workflow that is started on editing items. I modify a field specifically for this purpose per REST to trigger the workflow and let it set the permissions. Might not fit your scenario with a dynamic list of users, but perhaps the idea can help nevertheless.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.