Inconsistent Graph API Exchange results between immutable IDs and mutable IDs when using delta tokens

Ashlie Martinez 20 Reputation points
2023-04-25T17:20:46.22+00:00

Hi,

I'm seeing inconsistent results when moving an item between mail folders and using delta tokens to get the changes. The results change based on whether I've used Prefer: IdType="ImmutableId" in the header of my requests or not. Although I've only run this on mail, it's possible the issue also exists for other Exchange types that support immutable IDs. The specific set of actions I'm having trouble with is the following:

  1. use the delta API to enumerate all items in a mail folder (call it folderA) and get a delta token that can be used later to get new changes. Calls are made on the users/<user ID>/mailFolders/<folder ID>/messages/delta endpoint
  2. move an email from folderA to any other folder
  3. move the same email from the second folder back to folderA
  4. use the delta token obtained at the end of step 1 to request changes to folderA

When running the above without immutable IDs (i.e. the default behavior), the results from step 4 will show one item marked as "deleted" with the ID the mail originally had and a new item with a different ID representing the mail being moved back to folderA. This is expected since in this mode items are not guaranteed to have the same IDs after they're moved

However, when I run the above with the Prefer: IdType="ImmutableId" I only get one item marked as deleted and having the ID of the moved mail when running step 4. There is no other entry that denotes the mail was moved back to folderA. Requesting the next set of results from the delta token returned by step 4 does not show the mail being moved back to folderA nor does waiting some time between running steps 3 and 4. Moving the mail out of folderA after step 4 and then requesting changes via the delta token returned from step 4 will again show one item marked as "deleted" with the ID of the mail in question

As a point of comparison, I've also tested the following with Exchange mail:

  1. use the delta API to enumerate all items in a mail folder (call it folderA) and get a delta token that can be used later to get new changes. Calls are made on the users/mailFolders/<folder ID>/messages/delta endpoint
  2. move an email from folderA to any other folder
  3. use the delta token obtained at the end of step 1 to request changes to folderA
  4. move the same email from the second folder back to folderA
  5. use the delta token obtained at the end of step 3 to request changes to folderA

In the above scenario, both immutable IDs and mutable IDs return the same results for steps 3 and 5. At step 3 there is one item marked "deleted" returned and it has the ID of the moved mail. In step 5 there is one item returned and it either has the ID of the moved mail (immutable IDs) or a new ID (mutable IDs) Is there some other setting beyond the Prefer: IdType="ImmutableId" that I'm missing that would explain these inconsistent results?

Microsoft Security | Microsoft Graph
0 comments No comments

Your answer

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