I am using the piece of C# code in this link to access my Exchange 2010 server via EWS API 2.0. Now we are migrating the mailbox to the cloud and all the emails in the inbox and subfolders with it.
My question is when that happens will the myItem.Id
value still remain the same for each and every email? The Exchange admin says it will be unique across the Exchange servers. But I found no evidence of it from the tests I have I done so far. These emails get fed into a database and when the mailbox is migrated to the cloud, the application that processes these emails will see them as new emails due to myItem.Id
being not unique across both systems due to the migration.
My question is when that happens will the myItem.Id value still remain the same for each and every email?
No it won't, if the message is just moved between folder the Id will change. The EWSid is based on the underlying Exchange LongTermId https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcdata/8796d8f9-0052-4a5a-ab8e-e780b9c8a6bb. So it contains both FolderId and MessageId information (there is a global counter value involved) and some EWS specific flags . Its essentially a locator so it needs to be globally unique but in Office365 the underlying Store information changes (which affects the FolderId part of this id) so the ewsId will also change. Office365 offers immutableid's https://learn.microsoft.com/en-us/graph/outlook-immutable-id but you need to using the Graph API they didn't backport them to EWS.
For your migration you might want to consider creating your own custom property on items so you can still find them after the migration using a Search (or use an existing property like InternetMessageId or PidtagSearchkey)