We have a requirement of filtering the Users based on partial search on some field

BANERJEE Biswarup 0 Reputation points

We want to fetch a user based on partial search for example if this is the exact search
https://graph.microsoft.com/v1.0/users?$filter=mailNickName eq 'NLBBAN1'
This should be the partial search
https://graph.microsoft.com/v1.0/users?$filter=contains(mailNickName , 'BBAN')

https://graph.microsoft.com/v1.0/users?$filter=mailNickName has 'BBAN'

but none of them is working. Please let me know the correct way of doing the same.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,836 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 97,076 Reputation points MVP

    The Graph API supports StartsWith, EndsWith and Contains operators for this, as detailed here: https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http#operators-and-functions-supported-in-filter-expressions

    Be aware that not every property will support said operators though.