Microsoft Graph HonorNonIndexedQueriesWarningMayFailRandomly 筛选 SharePoint Online 列表时出错 [英] Microsoft Graph HonorNonIndexedQueriesWarningMayFailRandomly Error when filtering SharePoint Online lists

查看:16
本文介绍了Microsoft Graph HonorNonIndexedQueriesWarningMayFailRandomly 筛选 SharePoint Online 列表时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

选项 2. 附加标头 Prefer:HonorNonIndexedQueriesWarningMayFailRandomly

如错误消息所述,将指定的标头附加到请求中,例如在 Graph Explorer 中:

I'm using ms-graph with SharePoint Online. I've a simple list with a single title column and 3 items.

I use the following ms-graph call to filter items by title:

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

The result is an error message:

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.

I know that this call was working before and also when I use SharePoint REST API then I can filter the list without any problems. I also tried different tenants. Another fact is that the same call is working without the startswith filter.

Few days ago I had a different message for the same call.

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

解决方案

Regarding the following error:

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.

at least two options are available to surpass this error while filtering.

Option 1. Add an index to a SharePoint column

Once the index to a SharePoint column which participates in filtering is created, the error should no longer appear.

Option 2. Append header Prefer:HonorNonIndexedQueriesWarningMayFailRandomly

As the error message states append the specified header to request, for example in Graph Explorer:

这篇关于Microsoft Graph HonorNonIndexedQueriesWarningMayFailRandomly 筛选 SharePoint Online 列表时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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