SOLVED

Get recently added / updated users from Azure Active Directory

%3CLINGO-SUB%20id%3D%22lingo-sub-2608680%22%20slang%3D%22en-US%22%3EGet%20recently%20added%20%2F%20updated%20users%20from%20Azure%20Active%20Directory%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2608680%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EI%20want%20to%20fetch%20all%20the%20users%20from%20Azure%20Active%20Directory%20who%20are%20recently%20modified%2Fadded%20using%20Graph%20API.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20tried%20to%20search%20for%20the%20lastModified%2C%20or%20Modified%20property%20which%20returns%20the%20last%20modified%20date%20on%20which%20the%20filter%20can%20be%20applied%20but%20did%20not%20find%20any.%26nbsp%3B%20(Ref%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fresources%2Fuser%3Fview%3Dgraph-rest-1.0%23properties%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EUser%20Properties%3C%2FA%3E)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIs%20there%20any%20way%20to%20achieve%20the%20above%20requirement%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EMy%20goal%20is%20to%20get%20the%20users%20modified%20in%20a%20specific%20time%20frame%20and%20perform%20the%20business%20logic.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2608680%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECommunity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2608764%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20recently%20added%20%2F%20updated%20users%20from%20Azure%20Active%20Directory%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2608764%22%20slang%3D%22en-US%22%3ETake%20a%20look%20at%20delta%20queries%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fuser-delta%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fuser-delta%3Fview%3Dgraph-rest-1.0%26amp%3Btabs%3Dhttp%3C%2FA%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2609589%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20recently%20added%20%2F%20updated%20users%20from%20Azure%20Active%20Directory%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2609589%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3BI%20tried%20using%20delta%20queries%20but%20it%20returns%20all%20the%20users.%3C%2FP%3E%3CP%3EAlso%2C%20I%20am%20not%20getting%20the%20%3CSTRONG%3EnextLink%3C%2FSTRONG%3E%20or%20the%20%3CSTRONG%3EdeltaLink%3C%2FSTRONG%3E%20in%20the%20initial%20response.%3C%2FP%3E%3CP%3EBelow%20is%20my%20code.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Evar%20pagedCollection%20%3D%20await%20graphClient.Users%0A.Delta()%0A.Request()%0A.Select(%22userPrincipalName%2CjobTitle%2CmobilePhone%22)%0A.GetAsync()%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3BBelow%20is%20the%20response.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dhruvilp_0-1628074002279.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300415i0D95D3F4134CBF5F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22dhruvilp_0-1628074002279.png%22%20alt%3D%22dhruvilp_0-1628074002279.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAm%20I%20missing%20something%20here%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I want to fetch all the users from Azure Active Directory who are recently modified/added using Graph API.

 

I tried to search for the lastModified, or Modified property which returns the last modified date on which the filter can be applied but did not find any.  (Ref: User Properties)

 

Is there any way to achieve the above requirement?

 

My goal is to get the users modified in a specific time frame and perform the business logic.

3 Replies
best response confirmed by dhruvilp (New Contributor)

@Vasil Michev 

 I tried using delta queries but it returns all the users.

Also, I am not getting the nextLink or the deltaLink in the initial response.

Below is my code.

var pagedCollection = await graphClient.Users
.Delta()
.Request()
.Select("userPrincipalName,jobTitle,mobilePhone")
.GetAsync();

 Below is the response.

dhruvilp_0-1628074002279.png

 

Am I missing something here?

 

@dhruvilp 

Hello! You've posted your question in the Tech Community Discussion space, which is intended for discussion around the Tech Community website itself, not product questions. I'm moving your question to the Azure Active Directory space- please post Azure Active Directory questions here in the future.