Count of user/members from group azure AD using graph API - microsoft-graph-api

I need to take a count of each group from Azure AD using Graph API. Can anyone tell me how to achieve it

I also faced the similar issue. When I ran the end point mentioned in https://learn.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http#example-2-get-only-a-count-of-all-membership I got "$count is not currently supported."
However, if you notice the documentation clearly, it asks us to send in the ConsistencyLevel as eventual in the REST header. I got the correct response when I sent the header along with the call:
GET https://graph.microsoft.com/v1.0/groups/{id}/members/$count ConsistencyLevel: eventual

There is currently no Microsoft Graph endpoint to get the number of users.
You could list members by using:
GET https://graph.microsoft.com/v1.0/groups/{id}/members
And then handle the count of the members in your code.
See the reference here. Try it quickly with Microsoft Graph Explorer.

Related

How to get OrgContacts with Addresses with Microsoft Graph Delta endpoint?

I am trying to get the Org contacts of my tenant using this Delta endpoint:
GET https://graph.microsoft.com/v1.0/contacts/delta
which is documented here.
Unfortunately, this is not returned the Address of my contacts. In order to retrieve the addresses, I am obliged to call this endpoint instead:
GET https://graph.microsoft.com/v1.0/contacts
The issue is that I need to call the Delta endpoint because that returns the DeltaToken that I can use in the future to only pull the list of modified/deleted contacts.
Is there any workaround to do this, without having to go through both endpoints, the first one to get the DeltaToken, and the second one to get the addresses of my contacts? (PS: I tried the expand option with no luck).
Thanks!
AFAIK, Currently address of contacts is not returned using this delta endpoint.
Being said that, consider filing uservoice for your specific ask so it could be considered for future implementations.
Thanks.

Graph Schedule + Shifts API: MS-APP-ACTS-AS header needs to be set for application context requests

I am having issues running a GET against both the schedules and shifts v1.0 API. The documentation on the MS KB doesn't indicate that this is in preview any more, so I'm unsure what we're doing wrong here. The API is running with an app-only auth token
Postman screenshot
Currently we are doing prelim testing via postman to ensure we can use the API correctly.
The app in question has been given the following permissions:
Schedule.Read.All
Schedule.ReadWrite.All
We can view the teamId information correctly at https://graph.microsoft.com/v1.0/teams/{{TeamId}}, but schedules or schedules/shifts returns the error
Based on a previous answer I saw, I added the MS-APP-ACT-AS header with a UserId to act as, but it returned the same error
Thanks
Try to use this header instead:
MS-APP-ACTS-AS
In your question you wrote:
MS-APP-ACT-AS
(Missing the 'S')

Microsoft Graph API for Education: error listing user schools

I'm trying to retrieve the educationShool list of an educationUser from Microsoft Graph per the API reference:
I am getting this error:
Error message: The request URI is not valid. Since the segment
'memberOf' refers to a collection, this must be the last segment in
the request URI or it must be followed by an function or action that
can be bound to it otherwise all intermediate segments must refer to a
single resource.
I have reproduced this issue in the Graph Explorer, if I try to send this request, I get the same error:
https://graph.microsoft.com/v1.0/education/me/schools
If I try to list the Classes (I think it should be a very similar scenario), it works ok:
https://graph.microsoft.com/v1.0/education/me/classes
Am I doing something wrong, or is this a bug in the API?
I was able to reproduce this and it looks like there may be a bug here. While that gets investigated, I can confirm that it works properly in the /beta release:
https://graph.microsoft.com/v1.0/education/me/schools
I'd suggest using /beta for this particular call if possible.
Update: This issue has been resolved and education/{users}/schools should now be working in both v1.0 and Beta versions.

Returning employeeId of a user through MS Graph API

I've been trying to return the employeeId of a user through the Microsoft Graph API but so far haven't had much luck.
I'm assuming this is probably because it doesn't exist in the metadata for the user in the Graph API so makes sense.
However, the property is populated in Azure AD. If I use the AZ command prompt to query the user I can see the property. Likewise, if I query the old Active Directory Graph API endpoint I can even see it there.
For example, querying
https://graph.windows.net/{tennant}/users/{upn}?api-version=1.6 directly I receive the employeeId as part of the response (using the ActiveDirectoryClient however seems to ignore this property and doesn't store it anywhere).
Is there any reason for this? Wouldn't it make sense to have it returned as an additional property? I've also looked into extensions, but as it's not an extension isn't returned there.
Any help would be appreciated. I can get the information I need by querying the old endpoint directly, but this seems like a complete backwards step and involves multiple queries to get the information I need - including having to use multiple end points (one of which I assume will be deprecated and removed soon).
EmployeeId is currently a beta feature and is only available in the beta endpoint of the Graph API.
So if you want to access the beta endpoint you just have to change the version to beta in your url. For example:
https://graph.microsoft.com/beta/me/
https://graph.microsoft.com/beta/users/{id|upn}/
https://graph.windows.net/{tennant}/users/{id|upn}?api-version=beta
For more information about the user-object in the beta endpoint see: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/user

Asana api to get content from inbox

I want to get updates from asana inbox directly using asana api.
Is there any way this can be done using api as i am unable to find anything in api documentation. If there is anything that i might have missed in api please point me to that.
Unfortunately, we don't have an endpoint for the inbox. As was discussed in another question, you may be able to get this by grabbing every task across all projects into a local database. You would then need to search for tasks where assignee_status is set to inbox.

Resources