Sharepoint file permissions using Graph API

Pasquale Sociale 0 Reputation points
2025-03-26T11:09:07.59+00:00

Hi all,
I have been doing research for a while now, but haven't found a solution yet.
We developed a connector from our App to SPO using the Graph API. Our app is multi-tenant and uses application permissions.
The following permissions have already been granted by Tenant's admin:

"roles": [
  "Sites.FullControl.All",
  "Sites.Read.All",
  "Files.Read.All",
  "Group.Read.All",
  "GroupMember.Read.All",
  "User.Read.All",
]

I need to read the permissions on a file, and determine which users have access to that file.
GET /drives/{drive-id}/items/{item-id}/permissions

this returns a list of permissions and groups that have access to it.
Most of the groups have a numeric ID.
E.g.

"grantedToV2": {
 	"siteGroup": {
    	"displayName": "Test Site Group",
        "id": "17",
        "loginName": "Test Site Group"
        }
}

I created this group from Settings > Site permissions > Advanced permissions settings

  1. How do I get the list of members of this group?
  2. The file I am fetching the /permissions for has been shared with other users that do not belong to any group, yet these users are not returned with the /permissions response.

if I call

/sites/{site-id}/lists/User Information List/items?expand=field

I get the list of all groups and users that have somehow access to my Site.
the group id 17 from the example above is there, including its members, and so are the individual users the file has been shared with.

How do I get the full list of users who have access to the file?

So far I have only been able to retrieve the users that have access to the Site by fetching

GET /groups/{group-id}/members

on the only group that comes with a UUID instead of a numeric ID.

Fetching
GET /groups

does not return the groups I am interested in.

Thanks for your help

Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. Aashutosh Tiwari - MSFT 435 Reputation points Microsoft External Staff
    2025-03-27T11:04:21.4+00:00

    Hi Pasquale,

    Thank you for reaching out to Microsoft!

    1. To get the list of members of this group, you need to run this API https://graph.microsoft.com/v1.0/groups from which you will get the group-id of the particular groups which you want to see then, put that group-id in another API https://graph.microsoft.com/v1.0/groups/{group-id}/members then you will get all members. Please refer the snapshots step by step

    Step - 1:
    User's image

    Step-2:
    User's image

    Also, for your second question, please try calling graph API as per this example
    https://learn.microsoft.com/en-us/graph/api/driveitem-list-permissions?view=graph-rest-1.0&tabs=http#example

    Hope this helps.

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

    Was this answer helpful?


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.