Share via

Is it possible to share Sharepoint DriveItems via the Graph API with Sites.Selected Permissions

Justin 20 Reputation points
2023-05-23T22:52:34.3466667+00:00

I've got a similar situation to https://learn.microsoft.com/en-us/answers/questions/692704/is-it-possible-to-use-ms-graph-sites-selected-appl

I am attempting to share a DriveItem via the Graph API to external users. I am connecting to the Graph API using a ClientCertificateCredential with Sites.Selected scope.

Is this something that is supported? Or are the permissions listed here (https://learn.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0&tabs=http) up-to-date and either Files.ReadWrite.All or Sites.ReadWrite.All permissions are actually required?

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments

Answer accepted by question author

  1. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2023-05-24T08:15:10.13+00:00

    Hi @Justin,

    Sites.Selected permission is a more granular permission than Files.ReadWrite.All. If you want to create a sharelink by graph. You will need at least Files.ReadWrite.All permission. So if the role in Sites.Selected permission is lower than Files.ReadWrite.All permission, we will be unable to create the sharelink.

    Here is the document for more details

    https://learn.microsoft.com/en-us/graph/permissions-reference

    https://devblogs.microsoft.com/microsoft365dev/controlling-app-access-on-specific-sharepoint-site-collections/


    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.

    Was this answer helpful?

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.