Graph API Filter

Abhay Chandramouli 966 Reputation points


I need to filter users in adb2c where the value of state field is not set i.e = null (not in string but just null)

null and not "null"

Let me know the graph api query to achieve this

I have been stuck for a week

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
{count} votes

Accepted answer
  1. CarlZhao-MSFT 37,786 Reputation points

    Hi @Abhay Chandramouli

    Azure AD B2C does not support advanced queries, this is a known issue, so don't try to filter using the advanced query feature of the $filter query parameter. User's image

    The currently available method is to filter the user set using the graph C# SDK, please refer to my code snippet:

          var result = await graphServiceClient.Users.GetAsync();
          var userList = result.Value;
          for (int i = 0; i < userList.Count; i++) {
          if (userList[i].State == null) {
                var user = new Dictionary<string, object>();
                user.Add("id", userList[i].Id);
                user.Add("displayName", userList[i].DisplayName);
                user.Add("state", userList[i].State);
    catch (ODataError odataError)

    User's image

    Hope this helps. If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    0 comments No comments

0 additional answers

Sort by: Most helpful