question

OzairWani-7751 avatar image
0 Votes"
OzairWani-7751 asked saldana-msft edited

Bug? filter startswith property value set to empty is not supported

Trying to get users with startswith filter where property value is set to empty.

End Point : https://graph.microsoft.com/v1.0/users/?$count=true&$filter= startswith(displayName, '')

Expected Value : return empty list.

Actual Value : Error


{
"error": {
"code": "Request_UnsupportedQuery",
"message": "Unsupported or invalid query filter clause specified for property 'displayName' of resource 'User'.",
"innerError": {
"date": "2021-08-16T11:08:45",
"request-id": "00000000-0000-0000-0000-000000000000",
"client-request-id": "00000000-0000-0000-0000-000000000000"
}
}




azure-active-directorymicrosoft-graph-sdk
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

michev avatar image
0 Votes"
michev answered michev commented

Pretty sure the method expects a non-null string. If the idea is to filter out any users with "empty" displayName values, use advanced queries as detailed here: https://docs.microsoft.com/en-us/graph/aad-advanced-queries

 https://graph.microsoft.com/beta/users?$filter=displayName eq null&$count=true



· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@michev i run the query you suggest it did throwing the error
123670-image.png


0 Votes 0 ·
image.png (103.0 KiB)

oops i forget to add Consistencylevel in header . However you are right startsWith variant filter doesn't not support an empty filter value .I'm trying to understand what does this do when adding "ConsistencyLevel" in the header and will it have any impact on performance?

0 Votes 0 ·

It's explained in the article above. Basically it uses a different index, which might occasionally be out of sync with the primary, as in you might not be seeing the real-time data.

1 Vote 1 ·