Reputation: 65
I am trying to create a link to share a document with createLink
from Microsoft Graph for specific users without using an invite
but it is creating a link with Anyone with the link can edit this document
permission.
I'm calling this endpoint:
POST /me/drive/items/{itemId}/createLink
With this request body:
{
"type": "edit",
"scope": "anonymous"
}
Am I missing something?
Upvotes: 2
Views: 1663
Reputation: 11
Please refer this link https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_invite You can share the file with specific user by adding user's in "recipients":[{"@odata.type":"microsoft.graph.driveRecipient"}] parameter. You can set sendInvitation parameter like "sendInvitation":false to avoid sending the invitation mail.
Upvotes: 0
Reputation: 33114
You can't use createLink
for sharing with a specific person, you need to use the invite
endpoint for that.
The call you're making is responding exactly how you've asked it to and generating a link (createLink
) that anyone (anonymous
) can access.
If you don't want to send a physical invitation, you can tell OneDrive this by setting the sendInvitation
property to false
:
POST /me/drive/items/{item-id}/invite
Content-type: application/json
{
"requireSignIn": true,
"sendInvitation": false,
"roles": [ "write", "read"],
"recipients": [
{
"email": "[email protected]"
}
]
}
Upvotes: 3