question

Galaxiadev-7818 avatar image
0 Votes"
Galaxiadev-7818 asked saldana-msft edited

Fetching inbox messages based on a rule

Microsoft's Graph API has a provision to add [query parameters][1] to filter messages.
Is there any way we can fetch all messages that belong to a particular rule, if such a rule exists, by adding it as a query paramater? I could not find anything in the query parameters document.
Any help is appreciated. Thanks.
[1]: https://docs.microsoft.com/en-us/graph/query-parameters

microsoft-graph-mail
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Danstan-MSFT avatar image
0 Votes"
Danstan-MSFT answered

As far as I know, there is currently no Graph functionality to filter messages that belong to a rule. This may be because messages/messageRule association is not there as rules are applied on messages and that is it. You can heck the MS Graph Message Resource and see that this relationship doe not exist with messageRule resourcetype.

As a work around that may work for you, you can add the assignCategories action to the rules your target and filter out using categories like below.

 https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=categories/any(c:c eq 'My Rule Category').

If this answer is helpful please accept and upvote to help other users.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.