Azure AD B2C custom (extension) attribute in Microsoft Graph API Filter

mekbeb worku 26 Reputation points
2022-01-31T18:58:17.96+00:00

I am trying to filter users that don't have value for the custom (extension attribute) through the Microsoft Graph API to no avail. The following are some of my attempts

https://graph.microsoft.com/v1.0/users?$select=extension_Id_myCustomId&$filter=extension_Id_myCustomId eq ''
https://graph.microsoft.com/v1.0/users?$select=extension_Id_myCustomId&$filter=extension_Id_myCustomId eq null
https://graph.microsoft.com/v1.0/users?$select=extension_Id_myCustomId&$filter=extension_Id_myCustomId eq ' '

From what i see, the extension attribute only exists if there is a null value assigned to it. The JSON returned for all users shows these extension with values for those that have values but doesn't even show for those that are not given any value.

What type of Graph query should be good enough to get a list of users that don't have value for _myCustomId?

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Faith Moraa Ombongi 81 Reputation points Microsoft Employee
    2022-07-20T18:51:01.28+00:00

    Hi @mekbeb worku - I see this question is many months old and I hope you got the answer regardless.

    To offer the answer to anyone who may have the same question

    The URL syntax to filter directory extensions on null values for your scenario is:

       GET https://graph.microsoft.com/v1.0/users?$select=extensionPropertyName&$filter=extensionPropertyName eq null&$count=true  
       ConsistencyLevel: eventual  
    

    HOWEVER, the use of $count and the ConsistencyLevel header is advanced querying and isn't currently supported in Azure AD B2C. For more information, see Advanced query capabilities on Azure AD directory objects

    There's an open feature request to support advanced query capabilities in Azure AD B2C. You can amplify your voice here The $count and $search parameters are currently not available in Azure AD B2C tenants or here https://aka.ms/MsGraphAADSurveyDocs

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.