SharePoint Graph API Sharing Folder

Copper Contributor

I am currently creating a PowerApp for sharing files/folders in SharePoint. For sharing I am using the Graph API.

 

I am using the following API endpoint:
https://graph.microsoft.com/v1.0/sites/<site-ID>/drive/items/<item-ID>/invite

 

Using the following body/JSON:

{
  "recipients": [
    {
      "objectId": "6a078e6c-cecd-4906-a1df-83f6fc1cbcae"
    }
  ],
  "message": "Here's the file that we're collaborating on.",
  "requireSignIn": true,
  "sendInvitation": true,
  "roles": [
    "write"
  ]
}

 

For the Graph API, I created an app, with all the required delegated permissions.
The authentication is done with a secret.

 

So it works until the setting to limit external sharing to a Specific Group is set.
Then I get the error message that sharing is disabled on the SharePoint site.
Even though the app respectively the service principal is member in the group for external sharing.


I know the following alternative, but it does not meet my requirements:
Allow sharing only with existing guests and disable inviting guests by a normal user in Azure AD. Problem the sharing is possible with all existing guests.

 

Does anyone have an idea how I can solve the problem or has any other suggestions?

0 Replies