sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Sites.Selected delegated permission not working with SPFx web part

Open a1mery opened this issue 11 months ago • 1 comments

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

  • [ ] 💥 Internet Explorer
  • [X] 💥 Microsoft Edge
  • [ ] 💥 Google Chrome
  • [ ] 💥 FireFox
  • [ ] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [ ] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

  • SPFx v1.18.2
  • Node.js v18.18.0

Describe the bug / error

Sites.Selected delegated permission does not work as expected with SPFx web part using Microsoft Graph API to get a SharePoint site.

Steps to reproduce

  1. Build a SPFx web part to get a specific SharePoint site using the Microsoft Graph API (MSGraphClientV3)
  2. Deploy the web part requiring Sites.Selected permission: "webApiPermissionRequests": [ { "resource": "Microsoft Graph", "scope": "Sites.Selected" } ]
  3. The site can be retrieved even if no specific permission is granted for the site. All SharePoint sites the user can access can be retrieved from the web part.

Expected behavior

Only sites with specific permission/role can be retrieved from the SPFx web part.

a1mery avatar Mar 05 '24 22:03 a1mery