Microsoft Graph - how to `filter in` for a user extension property

Viewed 257

Working around microsoft graph api and stumbled upon this query that fails for some reason.

https://graph.microsoft.com/v1.0/users?$top=5&$select=displayName,id,extension_{ID}_ContactId&$filter=extension_{ID}_ContactId in ('11223344-5c2f-4b4d-94f6-d9a4ac441d75', '55667788-5c2f-4b4d-94f6-d9a4ac441d75')

response:

{
    "error": {
        "code": "InternalServerError",
        "message": "Value cannot be null.\r\nParameter name: elementType",
        "innerError": {
            "date": "2021-02-23T12:56:42",
            "request-id": "592915ae-c174-44e3-a4ca-9298e16bc3c6",
            "client-request-id": "592915ae-c174-44e3-a4ca-9298e16bc3c6"
        }
    }
}

However comparing single values seems to work just fine: https://graph.microsoft.com/v1.0/users?$top=5&$select=displayName,id,extension_{ID}_ContactId&$filter=extension_{ID}_ContactId eq '46450218-5c2f-4b4d-94f6-d9a4ac441d75'

Using ...&$filter=displayName in ('value1', 'value2') - also works just as expected.

Could someone point a meaningful lead to solve the error for elementType?

1 Answers

The error message is meaningless.

Based on Filter document:

Note: Support for these operators varies by entity.

Extension Property entity doesn't support in logical operator currently.

If we use the same operator in in Azure AD Graph, it will show Syntax error.

It is not difficult to draw a conclusion that in is not yet supported.

You can use extension_{ID}_ContactId eq 'value1' or extension_{ID}_ContactId eq 'value2' instead.

Related