API to get List of Persons having access to sharepoint folders

Prasanna Jain 21 Reputation points
2022-05-16T19:15:00.263+00:00

Dear Experts,

Is there any API through which i can get list of all users who have access to a particular folder ( say folder1) during certain day/time ?

As i want to monitor the access in my application so if these are exposed via API's would be preferred.

Looking forward for your kind help.

Best Regards,
Prasanna

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,684 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tong Zhang_MSFT 9,116 Reputation points
    2022-05-17T08:02:15.037+00:00

    Hi @Prasanna Jain ,

    According to my research and testing, there is no way to get list of all user who have access to a particular folder during certain day/time.

    However ,as a workaround, you can use the follow REST API to get which user have access to SharePoint folder:

    GET    /_api/web/lists/getByTitle('ListName')/items(item-id)/RoleAssignments?$expand=Member,RoleDefinitionBindings  
    

    OR

    GET   /_api/web/getFolderByServerRelativeUrl('/sites/xxx/test/newfolder1')/ListItemAllFields/RoleAssignments?$expand=Member,RoleDefinitionBindings   
    

    My test result:

    202690-001.png


    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.



0 additional answers

Sort by: Most helpful