4
votes

POST https://graph.microsoft.com/v1.0/drives/{driveId}/items/{itemId}/invite

Request Body:

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

Response Body:

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

I'm getting proper response with 200 ("OK") status code. But I'm not able to access the sharepoint folder with "[email protected]" account. Also when I'm checking the permissions on the folder in the sharepoint, the "[email protected]" id is not listed in manage access list.

1
are you sharing with an external user?Kashif Tahir
Yes, it was an external user and an outlook account.Prakash Verma

1 Answers

0
votes

This is a combination of 'By Design' and a bug. The 'By Design' part is that if you choose to not send the email invite, the user will not be able to access the document. The user typically needs to redeem the link in the invite before they get access. The bug is that the API response should still show that the user was granted access(although the invitation never got sent out, the invitation link however could be shared at a later time) . We are working on a fix. Thanks for bringing it up.