Microsoft Graph HonorNonIndexedQueriesWarningMayFailRandomly Error when filtering SharePoint Online lists

拈花ヽ惹草 提交于 2020-06-27 17:37:08

问题


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


回答1:


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:



来源:https://stackoverflow.com/questions/49169917/microsoft-graph-honornonindexedquerieswarningmayfailrandomly-error-when-filterin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!