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.01k forks source link

Sharepoint Search API not working. #8733

Open shoaib1713 opened 1 year ago

shoaib1713 commented 1 year ago

What type of issue is this?

Question

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

SharePoint REST API

Target SharePoint environment

SharePoint Online

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

Additional environment details

Issue description

When i am trying to call SharePoint search API via postman, i am getting below error. I have tried other SharePoint API and they working fine for me but when i am call search query API via Postman i am repeatedly getting below error.

API URL :- https://tenantname.sharepoint.com/_api/search/query?querytext='TestingFolder'

{ "odata.error": { "code": "-1, Microsoft.Office.Server.Search.REST.SearchServiceException", "message": { "lang": "en-US", "value": "Unauthorized." } } }

I have tried below AppPermissionRequests for my generated client_id.

`

`

`

`

`

`

these permission i have applied in appinv.asxp page. but still i am facing the same issue again and again.

please let me how to resolve this issue.

ghost commented 1 year ago

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

smolattack commented 1 year ago

Your issue might be related to #8436 Search just doesn't work with app registrations. Can you use the Graph API instead? https://learn.microsoft.com/en-us/graph/search-concept-searchall

INRLDX commented 1 year ago

SharePoint search works when you have access on particular site. Check for access on site. AppPermissionRequests are used when you need to access the azure resources like MS Graph API.

Harmeet94Singh commented 1 year ago

You got any solution @shoaib1713 ?