Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Contains filter on Microsoft Graph query not working

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?

like image 454
bstrm Avatar asked Feb 22 '16 15:02

bstrm


2 Answers

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').

like image 90
Marek Rycharski Avatar answered Nov 11 '22 03:11

Marek Rycharski


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

like image 6
Dan Kershaw - MSFT Avatar answered Nov 11 '22 04:11

Dan Kershaw - MSFT