Reputation: 137
My objective is to get list of users from Azure AD who are added after a specific date or month. But I have learnt that we can't filter users based on createdDateTime.
https://stackoverflow.com/a/54207506/8740131
According to this answer I have to use delta URL or function, so that I can get newly added users. I want to know the definition of 'new' according to the Graph api. I mean how old should the user object be, to be considered as new for Delta function on my initial request. I have gone through all the docs but couldn't find a solid answer.
Also please let me know if there is a new solution to filter users by created date. Any workaround will help too. Thank you.
Upvotes: 1
Views: 1244
Reputation: 137
Also to answer my other question on "how does microsoft graph differentiate between new and old users", incase someone has the same doubt -
When we initially call the delta function GET /users/delta
we get the list of all users that currently exist in Azure AD. The response object on initial request contains nextLink property if there is more data to be retrieved (next Page of results). And you keep making requests with nextLink from your previous response until you get a deltaLink property in the response object.
We store this deltaLink in our application and the next time when we make a GET request using this deltaLink, let's say after 15 days we call GET deltaLink
, the response object will contain users who are newly created, updated or deleted in the past 15 days(since your last GET delta function call)
Upvotes: 1
Reputation: 15754
According to some test, it seems graph api(list users) doesn't support filter createdDateTime
by gt
and lt
. But ge
(Greater than or equal) and le
(Less than or equal) are supported.
I request the graph api with:
https://graph.microsoft.com/v1.0/users?$select=createdDateTime&$filter=createdDateTime ge 2020-11-26T14:41:08Z
Upvotes: 0