Microsoft graph api /drives/{drive-id}/items/{item-id}/invite does not grant permissions to the given item for the invited user

David Pöschl 0 Reputation points
2023-07-18T12:12:50.7233333+00:00

The drive is a normal folder created on a sharepoint site(not a private OneDrive) with documents in the given drive-id. I can grant the given user permissions through the SharePoint UI.
When calling POST to /drives/{drive-id}/items/{item-id}/invite endpoint using Graph API explorer with this body:

{
    "recipients": [
        {
            "email": "{user-email}"
        }
    ],
    "message": "",
    "requireSignIn": true,
    "sendInvitation": false,
    "roles": [
        "write"
    ]
}

I get a response OK - 200 - 566ms with response body being:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(permission)",
    "value": [
        {
            "@odata.type": "#microsoft.graph.permission",
            "id": "{id}",
            "roles": [
                "write"
            ],
            "grantedTo": {
                "user": {
                    "email": "{correct-user-email}",
                    "id": "{correct-user-id}",
                    "displayName": "{correct-user-displayName}"
                }
            }
        }
    ]
}

This response contains only deprecated grantedTo without grantedToV2, and the user does not have the proper permissions for the given driveItem when I check it on SharePoint.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,244 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,230 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ChengFeng - MSFT 5,045 Reputation points Microsoft External Staff
    2023-07-19T06:36:41.2666667+00:00

    Hi @David Pöschl

    Personal OneDrive will not return the grantedToV2 parameter

    Here is a link for your reference:

    https://learn.microsoft.com/en-us/answers/questions/1079737/inconsistency-between-grantedtov2-and-grantedto-re


    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.

    Best Regards

    Cheng Feng


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.