Graph - Permission granted to a user, and the user gets deleted

Tony Huang 21 Reputation points
2022-12-20T06:57:11.487+00:00

I found that if I share a file to a user and then delete the user, the granted permission is still present in list permissions API response.
However, I noticed that there is a difference between responses of before and after user got deleted.
Before:

        {  
            "id": "permission_id",  
            "roles": [  
                "write"  
            ],  
            "grantedToV2": {  
                "user": {  
                    "@odata.type": "#microsoft.graph.sharePointIdentity",  
                    "displayName": "user name",  
                    "id": "73c051c4-caed-4536-913d-fabae560bab0"  
                },  
                "siteUser": {  
                    "displayName": "user name",  
                    "id": "128",  
                    "loginName": "i:0#.f|membership|user_123@example.com"  
                }  
            },  
            "grantedTo": {  
                "user": {  
                    "displayName": "user name",  
                    "id": "73c051c4-caed-4536-913d-fabae560bab0"  
                }  
            }  
        },  

After:

        {  
            "id": "permission_id",  
            "roles": [  
                "write"  
            ],  
            "grantedToV2": {  
                "siteUser": {  
                    "displayName": "user name",  
                    "id": "128",  
                    "loginName": "i:0#.f|membership|user_123@example.com"  
                }  
            },  
            "grantedTo": {  
                "user": {  
                    "displayName": "user name"  
                }  
            }  
        },  

grantedToV2.user is missing when the user is deleted.
^ Is this always true?

Microsoft 365 and Office | SharePoint | Development
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Answer accepted by question author
  1. Vicky Kumar (Mindtree Consulting PVT LTD) 1,161 Reputation points Microsoft Employee
    2022-12-20T10:17:26.963+00:00

    This is working as expected, as per the doc - https://learn.microsoft.com/en-us/graph/api/driveitem-list-permissions?view=graph-rest-1.0&tabs=http , you are providing the collection of permissions on a particular item, the items has still the write access but not assigned to any user, that's why you are not able to see grantedToV2.user. Hope i answered your question

    Thanks

    0 comments No comments

0 additional answers

Sort by: Most 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.