Contains filter on Microsoft Graph query not working

≯℡__Kan透↙ 提交于 2019-12-23 10:34:09

问题


I'm trying to user the contains filter on a /users query, like this for example: https://graph.microsoft.com/v1.0/users?$filter=contains(displayName, 'Garth')

However, this results in a BadRequest response saying "An unknown function with name 'contains' was found. This may also be a key lookup on a navigation property, which is not allowed."

According to the OData 4.0 specs, the contains filter should be available though. Is there a way to use a contains filter on a list of users?


回答1:


The contains function is not available for users. startsWith is available though.
e.g. https://graph.microsoft.com/v1.0/users?$filter=startswith(displayName,'Garth').




回答2:


Additionally you can try the people API (this is only available on /beta). This supports $search AND will do fuzzy and phonetic matching. https://graph.microsoft.com/beta/me/people?$search=Garth



来源:https://stackoverflow.com/questions/35557280/contains-filter-on-microsoft-graph-query-not-working

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