An API that connects multiple Microsoft services, enabling data access and automation across platforms
Hello Gambhir Kunwar,
Thanks for reaching out!
Yes, you can retrieve the count of active employees in Microsoft Graph by using the /$count endpoint with a specific filter. The /users/$count endpoint without any filter will return the total count of all users in the tenant, including both active and inactive users.
To get the count of active employees, you can apply a filter based on the user's account status. You can use the accountEnabled property to filter out the inactive users. The request would look something like this:
GET /users/$count?$filter=accountEnabled eq true
This will return the count of active employees in your tenant.
Regarding your second question, using the license count from the /subscribedSkus endpoint is not the recommended approach for getting the count of active employees. The subscribedSkus endpoint provides information about the licenses assigned to users, but it does not directly indicate the active user count. It's possible for users to have assigned licenses without being active users in the system.
Using the /users/$count endpoint with the appropriate filter is the recommended way to get the count of active employees in Microsoft Graph.
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.