Is there a way to get the folder ID of new emails created in webhook notifications?

Umair Ahmed 46 Reputation points
2021-11-24T07:47:25.673+00:00

Hi,

We are using webhook notifications on mailboxes of our users to track new emails that arrive in the mailbox. The notifications are subscribed as follows:

{
   "changeType": "created",
   "notificationUrl": "{our-internal-api-endpoint}",
   "resource": "/me/messages",
   "expirationDateTime": "{expiry-time}",
   "clientState": "SecretClientState"
 }

The notifications are being successfully received for any new emails that arrive in the mailbox and we mark that mailbox as changed in our database. Then we use delta query to get the change in that mailbox but the problem is that Microsoft Graph APIs only support delta queries on a specific folder and not the entire mailbox so for that reason we need to have knowledge of the folder where the new email is created. Currently, the change notification doesn't send the folder ID.

So, is there any way of getting the exact folder ID of the mailbox where the new email is created so that we can use it later in our delta query?

Any help regarding this use case shall be appreciated.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,965 questions
0 comments No comments
{count} votes