Can't get any search results from sites with Sites.Selected permission assigned
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
- Create an app registration and grant it Sites.Selected permission
- 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
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Hello. Any updates on this? Thanks!
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.
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.