Microsoft Graph API DeltaLinks for Shared Mailboxes Never Return Changes - microsoft-graph-api

I have a Office 365 Business Essentials Exchange Online Shared Mailbox I need to retrieve changes for on a scheduled basis. Access to this mailbox is granted to an AzureAD registered app via the Microsoft Graph API Mail.ReadWrite application permission. Admin consent has been acquired. Mailbox access is limited to just this one mailbox through an ApplicationAccessPolicy.
As this is a simple test case on a brand new mailbox that only contains a handful of test emails, I didn't use any filters or search terms. The initial request is in the format: https://graph.microsoft.com/v1.0/users/{ID}/mailFolders/{ID}/messages/delta?$select=sender,receivedDateTime,subject,body
I have no issues retrieving an access_token. The initial request and subsequent nextLink requests return results without issue as well. However, making a request against the deltaLink always returns an empty dataset. This occurs regardless of any changes made to messages in the folder since the deltaLink was retrieved. Instead I get the following response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(message)",
"#odata.deltaLink": "https://graph.microsoft.com/v1.0/users/{id}/mailFolders/{id}/messages/delta?$deltatoken=GoHFWffpmGHQHQdBstC3TW7TDQ4HvoU5hdqPXQ_DvM724L0CdVdFzRNBLVaICnIxrI9zMjxaHP7k0ncrSZj9L48EjNP7Hveu8IgKvkNUCGoRun6G89JzwGgNqn93Z4L5vtS8Fup2E6W6VD4LKMWehk5I6xWxPJMy8WwKsSrm8AJA0phlbIrqciV6G3MiQ67Q.xJrwL7OVVHnlcdTlcdctrLBRzRHLUZnpFCxbZL7MrCg",
"value": []
}
This behavior occurs whether I run the query from the registered application or via my own account using the Microsoft Graph Explorer.
Am I missing a step somewhere along the way or is this a bug? If the latter does anyone know of a workaround?

Related

Cannot get joined teams using Graph for external users using mail identity

I am attempting to use "v1.0/me/joinedTeams" to get all the joined teams for the currently authenticated user in my asp.net service. This works fine for external accounts that use a Microsoft identity (have a live account) but the same call returns a 400 Bad Request when I attempt to use an external account that uses a mail identity (no live account). The request is the same regardless of external account type. The token generated when authenticating as the mail identity external user looks correct when I inspect it.
I have been able to implement a workaround where I instead use the SharePoint REST service to get the groupId for the team site the user is apart of and then use the Graph call "v1.0/teams/{groupId}" to get that team. However, I need to do this for all the teams the external user has access to which slows things down quiet a bit.
I am aware of what looks like a bug in Graph when trying to make any Graph calls with any external user type, described here: https://github.com/OneDrive/onedrive-api-docs/issues/1039. I have also implemented the workaround for this issue which requires first accessing each site the user has access to by making some arbitrary call using the REST service. Then any subsequent calls using Graph should work. I do this for external accounts with a mail identity before trying to make the joinedTeams call but still run into the 400 response.
These workarounds will suffice in the short term but they increase my execution time significantly, especially when there is a large number of teams the external user is apart of. Any insight on a solution is greatly appreciated.
/me/joinedTeams is not available for personal Microsoft accounts. Se the table on this page

Microsoft Graph API callRecords Subscription not receiving notifications

I am currently evaluating Microsoft Teams Graph API endpoints for us and our customers. Our goal would be to compile a list of past callRecords for a specific user.
Since the API does not (currently) offer an endpoint to just fetch a list of past/done callRecords we need to subscribe to the /communications/callRecords notifications.
Using the example project specified in the documentation ( https://github.com/microsoftgraph/nodejs-webhooks-rest-sample) we successfully created subscriptions and were also able to update these subscriptions (not part of the example project).
I am running the example project on my local machine using ngrok as suggested.
So far everything works, but we do not get any notification. I made various calls with the Teams Desktop App using the same user that gave admin consent for accessing callRecords but I never received a notification on any test subscription.
The current active subscription in question is "07b23247-66d9-46b9-ac67-a72d5d702628" and was created around 2020-09-09T09:20:00.000Z (I do not have the precise minute/seconds). It since then has also been successfully renewed.
Here is an extract of the subscription creation response:
{
'#odata.context': 'https://graph.microsoft.com/beta/$metadata#subscriptions/$entity',
id: '07b23247-66d9-46b9-ac67-a72d5d702628',
resource: '/communications/callRecords',
changeType: 'created',
expirationDateTime: '2020-09-12T07:20:09.036Z'
}
I do monitor all incoming traffic using ngroks http://127.0.0.1:4040 endpoint and so far I only received the validationToken requests. That tells me that the endpoint does indeed receive requests.
I am currently at a loss as where to look further for an error on my side.
I opened this stack overflow is as it is the requested action to take according to the troubleshoot section of the example project (https://github.com/microsoftgraph/nodejs-webhooks-rest-sample/blob/master/TROUBLESHOOTING.md).

Can list messages but cant create subscription

I have an app that creates subscriptions for office365 users and does something whenever it gets a notification.
For 99% of users it works fine.
There's one user that I can't create subscription for even though he has an enabled exchange plan.
When I try to create subscription for him I get status code 404 and message: REST API is not yet supported for this mailbox.
However, I can list the user messages (i.e. mails) with API (GET request to https://graph.microsoft.com/v1.0/Users/{user_id}/messages)
Is it normal behavior? That user have no rest services enables for his mailbox (and therefore cant create subscription) but other rest services such as listing messages works just fine?
You are most likely getting this error because the organization has an hybrid deployment (Exchange on prem "linked" to the organization) and the mailbox that's failing is located on premises, not in the cloud.
Your application should handle the error and/or let the administrators know that this mailbox is failing, but there isn't much that can be done besides migrating the mailbox. For reference

Microsoft Graph - recent endpoint not returning recently used files

According to the documentation /me/drive/recent endpoint returns the list of recently used items by the signed in user.
However, regardless of the activity of the user, I couldn't get the list of recent files. I keep seeing the same response: empty response for personal account and some items that are unrelated to the user's activity for business account.
There is another enpoint /me/insights/used that returns exactly what I need. However, it is under beta and, what is more, it works only for business account.
How do I get recent files for both personal and business account?
Is there something wrong with /me/drive/recent endpoint?

Read co-workers planner tasks

Is it possible to retrieve a list of co-worker Planner tasks via the API?
For example the graph explorer provides the following GET endpoint:
https://graph.microsoft.com/v1.0/users/coworker-mail/planner/tasks
I can get results back using my own email address in url, but always a 403 failure when using a coworkers email.
I have Group.Read.All as a delegated permission on the app, I am an admin user and have granted consent via the admin consent endpoint to no avail.
Is this possible? If not what am i missing and why does the explorer/api expose that endpoint?
Thanks
Querying other users' data is currently not allowed. You can provide feedback about this behavior here.
The endpoint exists to support reading signed in user's data. "me" segment is simply an alias that in reality executes the request against /users/(signed in user id).

Resources