Microsoft Graph API: Sharing driveitem file permission is worked but when update the shared file permission using permission id getting access denied

testuser 1 Reputation point
2022-03-22T11:26:20.18+00:00

Microsoft Graph API: Sharing driveitem file permission is worked but when update the shared file permission using permission id getting access denied

https://graph.microsoft.com/v1.0/drives/{drive_id}/items/{drive_itemid}/permissions/{permission_id}

getting access denied

below mentioned permission are added in my application
Files.ReadWrite, Files.ReadWrite.All, Sites.ReadWrite.All

185536-image.png

Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Sheena-MSFT 1,736 Reputation points
    2022-03-25T15:01:43.193+00:00

    Hi @testuser ,

    As per my testing we can edit the role/permission that are granted to the recipients of the sharing invitation using this permission-update API with global admin account/tenant admin account who has been shared the invite.

    If you are trying to edit role/permission from that particular user who has been invited then that user must have role owner. With read/write role we will get access denied error.

    To give owner role to another user use the below query:

      Post https://graph.microsoft.com/v1.0/drives/b!LyWi4x3ZA0ymcGgud7voumd2ty54z5VCgTAzO3fUgHq2GVB6zkWDQKBGPVxEOtg8/items/01KGX6IABKL7ARJX4GQZGLXF4XMQBJQICS/invite  
          
      {  
        "requireSignIn": true,  
        "sendInvitation": true,  
        "roles": [  
            "sp.full control"  
        ],  
        "recipients": [  
            {  
                "email": "******@gggg.onmicrosoft.com"  
            }  
        ],  
        "message": "hi"  
    }  
    

    Please find below screenshot for your reference:

    186997-invite1.png

    187024-invite2.png

    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.

    0 comments No comments

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.