How to filter/query multiple messages with Microsoft Graph API

Hda 0 Reputation points
2024-05-21T12:20:42.2466667+00:00

Hello !
I would like to filter / query on custom attributes on /messages

I have an Azure mail server that allows me to retrieve received emails via Microsoft's Graph API. I would like to avoid retrieving all emails and instead only retrieve those where "alreadyFetched" ne true, for example.
"alreadyFetched" would be a custom value affected to all mails with the default value false. Then, when I fetch all mails I patch the value to true.
I have read about extensionAttributes, open extensions, and schema extensions, but I am not sure how to implement them to achieve my goal. I have managed to do it one message at a time using open extensions:

POST https://graph.microsoft.com/v1.0/me/messages/{messageId}/extensions

Then I can filter with the $filter=extensions/any

But I can't create extension for every /message when dealing with thousands of emails.

Any suggestions on how I can accomplish this?

Do you have an Idea on how could I do ?

Thank you.

Microsoft Security Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Hda 0 Reputation points
    2024-05-22T07:50:26.86+00:00

    I will use lastModifiedDateTime, Thank you

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.