4

According to this documentation Synchronize messages API users have ability to synchronize messages with pretty simple skipToken mechanics. And it works well for fetching new messages in folders.

But! What I'm also interested is how to sync flags and status like is message read or not. For example I synced all messages from Inbox folder. After that user goes to his Outlook account and reads message and set some flag for this message.

How can I get this info? Should I resync all messages to get only those changes?

Also how I get notion about message removal? If some user deleted message from inbox, how I get to know which message was deleted without fetching all messages again?

user1876339
  • 319
  • 1
  • 2
  • 7

1 Answers1

0

You should use the Microsoft Graph API and move away from using the Outlook Rest API as it has been deemphasized with no more effort being put into the developer experience.

Use Microsoft Graph to synchronize and track changes by using the Delta query feature.

An initial sync call will happen with a Delta query. Make sure you select the properties you care about:

GET https://graph.microsoft.com/v1.0/me/mailfolders/AQMkADNkNAAAgEMAAAA/messages/delta?$select=subject,sender,isRead
Prefer: odata.maxpagesize=50

If the response has an @odata.nextlink in the response JSON object, GET that URL to the next page of results.

If the response has an @odata.deltaLink in the response JSON object, cache that URL until the next time you want to check for changes.

Michael Mainer
  • 3,387
  • 1
  • 13
  • 32