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 不返回任何结果
基础教程推荐
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
