0

With an items query like this: _api/web/lists/getbytitle('Docs')/items

Is it possible to also include what permission level the current user has on a given item?

My list items have unique permissions, and a user may have read or edit permissions on the data returned. I'm wondering if there is a way via a single REST query to include that information along with the list item data.

1 Answer 1

0

You can get the RoleAssignments of list items using single REST endpoint in below format:

<siteUrl>/_api/Web/Lists/getByTitle('List Name')/items?$select=Title,RoleAssignments&$expand=RoleAssignments

This will give you user PrincipalId which you can match with current user ID in client side code (JavaScript).

<d:PrincipalId m:type="Edm.Int32">4</d:PrincipalId>
2
  • I'm looking for the permission level - whether they have read or write access. I didn't see that in the returned data with RoleAssignments. Commented May 26, 2021 at 16:52
  • 1
    I don't think you can get all permission details in one call. You can get the permissions for specific PrincipalId using endpoint like: .../Items(1)/RoleAssignments/GetByPrincipalId(3)/RoleDefinitionBindings Commented May 26, 2021 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.