Azure graph API for users doesn't support filter by createdDateTime anymore

Maluenda Miranda, Cristian G 116 Reputation points
2021-08-02T23:15:01.8+00:00

Hi,
We have a job that searches the users created between two dates. It was working fine until the last week. Suddenly, Microsoft decided to not support filters by "createdDateTime" for Users anymore, despite the documentation says it is supported (https://learn.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0).

Now, our job is broken and I need to find a walkaround to search the users created daily. I am not sure if the delta link will help me, because the job is stateless.

Regards,
Cristian.

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

Accepted answer
  1. Maluenda Miranda, Cristian G 116 Reputation points
    2021-08-25T20:03:13.703+00:00

    Microsoft fixes this issue, but it doesn't support just the date. It is necessary to include the time.
    Here is an example:

    https://graph.microsoft.com/v1.0/users?$filter=(createdDateTime ge 2021-07-01T00:00:00Z AND createdDateTime le 2021-08-01T00:00:00Z)
    

    It is not necessary to use any advanced query parameters!

    1 person found this answer helpful.

5 additional answers

Sort by: Most helpful
  1. Danstan Onyango 3,816 Reputation points Microsoft Employee
    2021-08-03T15:45:26.927+00:00

    The filter requires the Advanced Query Options.

    To get it to work you need to add the count operator and the ConsistencyLevel=eventual. Example

    GET https://graph.microsoft.com/v1.0/users?$filter=createdDateTime eq 2021-04-06T08:03:07Z&$count=true  
    ConsistencyLevel: eventual  
    
    1 person found this answer helpful.

  2. Maluenda Miranda, Cristian G 116 Reputation points
    2021-08-03T19:22:20.803+00:00

    Thanks, Danstan for your answer.
    I tried to use the advance query option, as you suggested, but I got the same error:
    "Unsupported or invalid query filter clause specified for property 'createdDateTime' of resource 'User'."

    Something that I don't understand is, I am using the operators "ge" and "le" and the documentation says those operators are supported by default.

    Summary, my filter "(createdDateTime ge 2021-07-28 AND createdDateTime le 2021-07-29)" doesn't work using the default or advance query parameter.


  3. ssk 1 Reputation point
    2021-08-10T12:28:17.217+00:00

    Hi @Danstan

    I'm also having the same exact problem even by using the advanced query options.

    Any ideas ?


  4. Maluenda Miranda, Cristian G 116 Reputation points
    2021-08-12T18:01:28.92+00:00

    This is getting worst!
    I tried to loop over the users and filter them out in my code.
    When we are iterating over all the users using paging (https://learn.microsoft.com/en-us/graph/paging), we get this error:

       status: 414,  
        statusText: 'URI Too Long',  
    

    In summary, there is not any way to get the users between two dates!

    -------------

    Update:

    The problem was I added to the request the query parameter select in each call, and Azure Graph API was appending the same values to the query parameter all the time. So, the URI grew until Azure threw the error.
    I believe this wasn't the behavior before the change, but I can't prove it.

    0 comments No comments