How can I perform one rest api call to query all users BasePermmisions to a Sharepoint file

Gal Yaniv 65 Reputation points
2023-02-05T15:08:30.41+00:00

I'm currently using this API Call:

http://<site-url>/_api/web/getfilebyserverrelativeurl('<file-path>')/ListItemAllFields/getusereffectivepermissions(@user)?@user='<domain\user>'

This API call only gives me one user BasePermissions to the file while I need multiple users BasePermissions in one query.

I would appreciate suggestions.

Thanks,

Gal

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2023-02-06T02:23:02.6166667+00:00

    Hi @Gal Yaniv

    Per my test, you can use RoleAssignments.Member property which contain information about user or group, and RoleDefinitionBindings information about permission level.

    /_api/web/lists/getByTitle('Documents')/items(1)/RoleAssignments?$expand=Member,RoleDefinitionBindings
    

    Here is part of the test result

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.