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

Can't get any search results from sites with Sites.Selected permission assigned

Open erkanch opened this issue 2 years ago • 3 comments

Target SharePoint environment

SharePoint Online

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

SharePoint CSOM

Developer environment

Windows

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

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

Additional environment details

  • browser version
  • SPFx version
  • Node.js version
  • etc

Describe the bug / error

I've assigned 2 sites full control using Grant-PnPAzureADAppSitePermission. I get "Exception thrown in SearchContent: SharePoint Rest service exception" when I try to perform a search. Is it possible to perform searches with the Sites.Selected Sharepoint app permission?

Steps to reproduce

  1. Create an app registration and grant it Sites.Selected permission
  2. Try submitting a search request using (var pnpContext = await this._pnpContextFactory.CreateAsync(siteUrl, authProvider)) { results = await pnpContext.Web.SearchAsync(searchOptions); }

Expected behavior

Receive search results from the sites granted Sites.Selected permission

erkanch avatar May 22 '23 21:05 erkanch

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar May 22 '23 21:05 ghost

Hello. Any updates on this? Thanks!

erkanch avatar Jun 16 '23 17:06 erkanch

It's been more than a year without any update on this topic.

This should be categorized as a bug, because Sites.Selected is essentially a SCOPE and NOT the permission itself.

We have a selection of Sites where the App has Full Control and just the search doesn't work. It shouldn't throw "No User or App Context found" error since there is no user context even when we change the permission from Sites.Selected to Sites.Read.All.

kumaranupam21 avatar Jun 21 '24 08:06 kumaranupam21

Thank you for taking the time to file an issue. We periodically archive older or inactive issues as part of our issue management process, which automatically closes them once they are archived.

If you’d like to understand more about why and how we handle archived (closed) issues, please see Our approach to closed issues.

We appreciate your contribution and if this is still an active issue with the latest SPFx versions, please do resubmit the details. We needed to perform a cleanup, so that we can start with a clean table with a new process. We apologize for the inconvenience this might cause.

github-actions[bot] avatar May 02 '25 15:05 github-actions[bot]