Microsoft Graph: Search for DriveItems on a SharePoint drive returns no results(Microsoft Graph:在 SharePoint 驱动器上搜索 DriveItems 不返回任何结果)
问题描述
我在 SharePoint 驱动器中有文件并且想要开发全文搜索.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 Endpoint,但没有区别.
_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 不返回任何结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Microsoft Graph:在 SharePoint 驱动器上搜索 DriveItems 不返回任何结果


- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 输入按键事件处理程序 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01