I am trying to search a file by passing a query text. When i am trying in a specific Site using https://graph.microsoft.com/v1.0/drives/b!l17-JY94D0CQp-2TBvsujaBLMUF2WrJHp5VylCDZThrZfpCdF-7uQ6MRp6t-MSRb/root/search(q='sharepoint') it is working fine and i am able to get the response with the File name. Since we have multiple sites and we want to search in all the sites for this when i am trying to search globally in all the sites and drives using http://{server}/_api/search/query?querytext='sharepoint' setting Get method i am not getting any resposne. when i click Run Query in Graph API Eplorer it is not loading at all. Can anyone please help me on this.
1 Answer
To troubleshoot the issue, you could check if the file can be searched in the SharePoint site.
Then you could check if the file exists in the SharePoint site.
The URLs of the Graph API and SharePoint Rest API in your post are correct.
If you use the http://{server}/_api/search/query?querytext='sharepoint' to search, it only can search the content in the site collection http://{server}.
More references:
-
Hi Amy, Is there any difference between SharePoint Site ? since i am not a SharePoint developer i don't know what you mean Sharepoint site. I just logged into Office 365 and clicked on SharePoint and i see multiple sites available when i search with keyword i am able to see the document. when i try with my 3rd party system i am authentication error 401 Response code. Commented Aug 20, 2019 at 6:14
-
which site did you store the file? When you search by clicking on SharePoint, it can search all content in SharePoint online, so you can find the file.– Amy_MSFTCommented Aug 20, 2019 at 6:51
-
If you search on specific site, you should search the site which stores the file, then you can find the file.– Amy_MSFTCommented Aug 20, 2019 at 6:52
-
Amy, I think i am near i am authentication error. when i try with Sharepoint Search Query Tool with the same End point and setting the authentication via Sharepoint Online (App Id) i am getting the response. But i am not sure how to set the authentication in POSTMAN. I kept basic authentication and gave my log in credentails then it is not working. I am getting <m:code>-2147024891, System.UnauthorizedAccessException</m:code> <m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource.</ Commented Aug 20, 2019 at 7:42
-
Can you please guide me how to set the Sharepoint Online (App id) credentials in POSTMAN. then i think i might get the results Commented Aug 20, 2019 at 7:44