Building custom solutions that extend, automate, and integrate Microsoft 365 apps.
Based on my research and understanding, I would like to share some information that I hope it will be help:
Server-Side Filtering on Message Properties (Current Status)
You are correct that some filtering is possible, it may be restricted. Microsoft Graph provides limited support for the $filter query parameter in the resource URL when creating a subscription for Outlook messages. However, this support is restricted to a very small number of specific properties (such as isRead) and does not cover the common business-filtering scenarios you've described.
Specifically, there is no documented support for server-side subscription filtering based on:
- Sender email address (
from) - Specific recipients (
toRecipients) - Subject keywords
- Message categories
- Custom or extended properties
Therefore, while the mechanism exists in a limited form, it is not a viable solution for the requirements you've listed.
Optimized Client-Side Filtering
Here is the recommended workflow for a highly performant solution you can try:
1/ Subscribe to the Narrowest Possible Resource.
While you can't filter on most properties, you can filter by folder. If your use case is limited to the Inbox, subscribe there. This is the most effective server-side reduction you can perform. "resource": "/users/{user-id}/mailFolders('Inbox')/messages"
2/ Process the Notification:
- Standard Notifications (Default): The payload you receive is very lightweight and contains only the ID of the changed resource, not the message data itself. This design requires your application to make a follow-up
GETcall to fetch the message details. - Rich Notifications (
includeResourceData: true): If you use this option, the notification payload will include the resource data. This avoids the secondGETcall but results in larger notification payloads. - Fetch only the Properties You Need (for Standard Notifications). This is the most critical optimization. When you make the follow-up
GETcall for the message, use the$selectOData query parameter to retrieve only the properties required for your filtering logic. This drastically reduces payload size and API latency. Example: If you only need to filter by sender and subject, yourGETrequest should be:
GET https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}?$select=from,subject
3/ Apply Your Business Logic.
In your code, inspect the properties you retrieved. If they match your criteria, proceed with your business process. If not, discard the event.
To summarize, comprehensive server-side filtering for Outlook mail webhook notifications is not broadly supported. While very limited support exists for specific properties, it does not cover the common business scenarios of filtering by sender, subject, or categories.
The standard and recommended architecture is to implement the filtering logic on the receiving side (your webhook endpoint), using folder subscriptions and the $select parameter to keep the process as efficient as possible.
The Microsoft Graph team is aware this is a highly requested feature. I recommend you add your voice and vote for it on the Microsoft Graph Feedback Portal, as customer feedback directly influences our roadmap.
I hope this helps. If you have any question, please feel free to ask via comment section!
(Please understand that we're not Microsoft support, this is a user-to-user support forum. Moderators have no backend access and cannot directly intervene in Microsoft products. We provide only technical guidance and best-practice recommendations based on reported issues)
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.