Microsoft Graph: Search for DriveItems on a SharePoint drive returns no results

两盒软妹~` 提交于 2019-12-08 07:56:51

问题


I have files in a SharePoint Drive and want to develop a full-text search. The following call in the Graph Explorer works, finding my files either by filename or content:

https://graph.microsoft.com/v1.0/drives/{my drive id}/root/search(q='my search word')

The same call from my Azure hosted ASP.NET app using the Microsoft.Graph-NuGet package allways returns an empty list:

await _client
  .Drives[{my drive id}]
  .Root
  .Search({my search word})
  .Request()
  .GetAsync()

_client is an authenticated GraphServiceClient. For authentication, I receive a token through the Azure AD endpoint (app registered in the Azure Portal), not from the v2 Endpoint (app registered in the Application Registration Portal). To exclude this as a reason, I used the v2 Endpoint but there was no difference.

The application has the Files.ReadWrite.All permission scope. Receiving, saving and deleting files works fine. Only searching fails.

As a test, I gave my application all rights Graph Explorer has with no difference. I compared the URL the GraphServiceClient prepared but everything looked fine.


回答1:


This question described the same problem two days later. In a comment the author stated, it started working yesterday without him changing anything. I tested it today with my same old Code. What can I say? It works now! Looks like it was a bug on Microsofts side?



来源:https://stackoverflow.com/questions/52407698/microsoft-graph-search-for-driveitems-on-a-sharepoint-drive-returns-no-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!