Is there a graph api which allow us to share a sharepoint document with external users using "People you chose"

john john 1,021 Reputation points
2023-05-11T23:11:13.0766667+00:00

Inside the SharePoint online UI we can share a file with external users using "People you chose":-

User's image

So is there an equivalent end point in Graph API which allow me >> to send a sharing link to external users by email + with Read-only permission (which mimic the functionalities in the above picture)?

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ab-8756 805 Reputation points
    2023-05-12T12:46:57.8566667+00:00

    Hello john john,
    Thank you for posting in this Q&A Forum.

    You can use POST /drives/{driveId}/items/{itemId}/createLink API endpoint to share a SharePoint document with external users. In the Scope parameter you can set it to "anonymous" Anyone with the link has access, without needing to sign in, the driveId is the SharePoint drive where the document is located, Itemid is the id of the document.
    In the body you can use type, scope, password, message, recipients
    https://learn.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0&tabs=http

    Once you created the CreateLink API endpoint, you will receive a response that includes the URL of the sharing link.

    Hope that helps.
    Thanks
    --please don't forget to upvote and Accept as answer if the reply is helpful--


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.