Microsoft Graph:在SharePoint驱动器上搜索DriveItems不会返回任何结果 [英] Microsoft Graph: Search for DriveItems on a SharePoint drive returns no results

查看:58
本文介绍了Microsoft Graph:在SharePoint驱动器上搜索DriveItems不会返回任何结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SharePoint Drive中有文件,并且想要开发全文本搜索. Graph Explorer中的以下调用有效,可以通过文件名或内容查找我的文件:

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')

使用Microsoft.Graph-NuGet包从我的Azure托管ASP.NET应用程序进行的相同调用始终返回一个空列表:

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是经过身份验证的GraphServiceClient.为了进行身份验证,我通过Azure AD终结点(在Azure门户中注册的应用程序)而不是从v2终结点(在应用程序注册门户中注册的应用程序)接收令牌.为了排除这种情况,我使用了v2端点,但是没有区别.

_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.

该应用程序具有Files.ReadWrite.All权限范围.接收,保存和删除文件效果很好.仅搜索失败.

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

作为测试,我为我的应用程序提供了Graph Explorer的所有权利,没有任何区别.我比较了GraphServiceClient准备的URL,但一切看起来都很好.

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.

推荐答案

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?

这篇关于Microsoft Graph:在SharePoint驱动器上搜索DriveItems不会返回任何结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆