SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.25k stars 1.02k forks source link

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

Open erkanch opened 1 year ago

erkanch commented 1 year ago

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

Additional environment details

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

ghost commented 1 year ago

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

erkanch commented 1 year ago

Hello. Any updates on this? Thanks!

kumaranupam21 commented 5 months ago

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.