Can we setup Microsoft webhook change notifications on message resources with filters?

Umair Ahmed 46 Reputation points
2021-11-04T14:40:21.943+00:00

We're following this document: webhooks to setup webhook notifications to subscribe to any new emails in mailbox of a specific user. But we don't want to get notifications for new emails in certain folders e.g. Sent, Drafts. So, can we specify a filter to only give us notifications for certain folders by giving their IDs as shown below:

{  
  "changeType": "updated",  
  "notificationUrl": "https://webhook.azurewebsites.net/notificationClient",  
  "resource": "users/34efd5d6-e729-44b8-b109-4f3e5274cdda/messages$filter=parentFolderId eq 'AQMkADY4N2YwYmQwLWQyNTEtNGFhAGItYWVmYi0zNDZmOGFjZTljNGIALgAAA_5PEj-ru5tEoSQhNZMolB0BANwG7UKC_KZBtlthtZP2hSQAAAIBCQAAAA=='",  
  "expirationDateTime": "2016-03-20T11:00:00.0000000Z",  
  "clientState": "SecretClientState"  
}  
Microsoft Graph Change Notifications API
Microsoft Graph Mail API
Microsoft Graph Mail API
A Microsoft API that supports accessing data in users' primary mailboxes and in shared mailboxes.
683 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shivam Dhiman-MSFT 4,406 Reputation points Microsoft Employee
    2022-02-03T18:23:08.29+00:00

    Hi @Umair Ahmed ,

    To receive change notification subscription for particular folder in your outlook you can create a subscription for a specific Outlook folder using the below query.

    API Inbox: me/mailFolders('inbox')/messages
    171038-notification.png

    This will help you to create notification for particular folder from your mailbox so that you can receive the notification only for the required folder.

    You can refer to this link for further details .
    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".

    No comments