microsoft-graph-api - Microsoft Graph HonorNonIndexedQueriesWarningMayFailRandomly 过滤 SharePoint Online 列表时出错

标签 microsoft-graph-api sharepoint-online

我在 SharePoint Online 中使用 ms-graph。
我有一个简单的列表,其中包含一个标题列和 3 个项目。

我使用以下 ms-graph 调用按标题过滤项目:

https://graph.microsoft.com/v1.0/sites/root:/lists/list-guid/items?expand=fields&filter=startswith(fields/Title,%27fig%27)

结果是错误信息:

Field 'Title' cannot be referenced in filter or orderby as it is not indexed. Provide the 'Prefer: HonorNonIndexedQueriesWarningMayFailRandomly' header to allow this, but be warned that such queries may fail on large lists.



我知道这个调用在我使用 SharePoint REST API 之前和之前都有效,然后我可以毫无问题地过滤列表。我也试过不同的租户。
另一个事实是相同的调用在没有开始过滤器的情况下也能工作。

几天前,我收到了同一个电话的不同信息。

"Field 'Title' cannot be referenced in filter or orderby as it is not indexed. Provide the 'allowthrottleablequeries' preference to allow this, but be warned that such queries may fail on large lists."

最佳答案

关于以下错误:

Field 'Title' cannot be referenced in filter or orderby as it is not indexed. Provide the 'Prefer: HonorNonIndexedQueriesWarningMayFailRandomly' header to allow this, but be warned that such queries may fail on large lists.



过滤时至少有两个选项可以克服此错误。

选项 1. 向 SharePoint 列添加索引

曾经index to a SharePoint column参与过滤的创建,该错误应该不再出现。

enter image description here

选项 2. 附加标题 Prefer:HonorNonIndexedQueriesWarningMayFailRandomly
正如错误消息所述,将指定的 header 附加到请求中,例如在 Graph Explorer 中:

enter image description here

关于microsoft-graph-api - Microsoft Graph HonorNonIndexedQueriesWarningMayFailRandomly 过滤 SharePoint Online 列表时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49169917/

相关文章:

microsoft-graph-api - 是否有 API 端点可以找到私有(private) channel 的驱动器

javascript - 对日历进行图形 API 调用时出现 "Access to OData is disabled"错误

azure - 如何使用 Azure AD 登录我的 .NET API?

microsoft-graph-api - 如何在 Microsoft Graph .NET SDK 中执行 POST 批量请求

c# - MS图: How To Distinguish Teams-Enabled M365 Groups Using GraphClient?

authentication - 如何使用 CSOM 通过 SharePoint-Online 进行多因素身份验证

azure-active-directory - 有什么方法可以通过 Graph Explorer API 获取所有应用程序的主列表

c# - 如果数据库中插入新记录,如何更新 SharePoint Online 列表?

c# - Microsoft.Graph GetAsync() 无限期挂起

Sharepoint Graph API 从文档库下载未列为驱动器 ("Site Pages"等的文件)