How to fetch ACLs of a SharePoint data?

Yichen Name 66 Reputation points
2022-10-20T10:50:23.277+00:00

I need to check ACL of each item in SharePoint so that I know which user or group has allow access and which has deny access.

Is there any SharePoint rest API available for this?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,073 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,767 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 32,726 Reputation points Microsoft Vendor
    2022-10-21T01:34:52.95+00:00

    Hi @Yichen Name
    Please refer to following rest api to retrieve users have permission to the item.
    Retrieve Role Assignments for a list:

     /_api/web/lists/getbytitle('list title')/roleassignments?$expand=Member/users,RoleDefinitionBindings  
    

    Retrieve Role Assignments for a listitem:

     /_api/web/lists/getbytitle('list title')/items(id)/roleassignments?$expand=Member/users,RoleDefinitionBindings  
    

    Check if site/list/listitem has a unique permission:

     /_api/web/HasUniqueRoleAssignments  
     /_api/web/lists/getbytitle('list title')/HasUniqueRoleAssignments  
     /_api/web/lists/getbytitle('list title')/items(id)/HasUniqueRoleAssignments  
    

    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.