Home > Blockchain >  Get the anniversary of the users using graph api
Get the anniversary of the users using graph api

Time:11-16

From the Distribution list of users need to get the list users who are going to complete their work anniversary in the next month using filter. Able to get the users employee hire date need a filter for the Employee hire date property based on the month so that instead of pulling all the users specific group of users i can fetch

CodePudding user response:

Unfortunately, you can't filter employeeHireDate by year, month or a day.

You need to send several requests to get all data you need. For filtering by employeeHireDate you need to add header ConsistencyLevel:eventual and query parameter $count=true

Get users with one year anniversary in the next month

https://graph.microsoft.com/v1.0/users?$select=displayName,employeeHireDate&$filter=employeeHireDate ge 2021-12-01T00:00:01Z and employeeHireDate le 2021-12-31T23:59:59Z&$count=true

Similar for users with 5, 10, etc. years anniversary

https://graph.microsoft.com/v1.0/users?$select=displayName,employeeHireDate&$filter=employeeHireDate ge 2017-12-01T00:00:01Z and employeeHireDate le 2017-12-31T23:59:59Z&$count=true

https://graph.microsoft.com/v1.0/users?$select=displayName,employeeHireDate&$filter=employeeHireDate ge 2012-12-01T00:00:01Z and employeeHireDate le 2012-12-31T23:59:59Z&$count=true
  • Related