MailKit.Net.Imap has MoveTo(...). But if we move the Messages the messages will get new UniqueID (since it's unique by folder). How do I get the new UniqueID of the Message?
Asked
Active
Viewed 4,955 times
1 Answers
8
The MoveTo methods that take a UID (or list of UIDs) will return the UID(s) of the messages in the destination folder.
var uidMap = folder.MoveTo (uids, destination);
foreach (var uid in uids) {
Console.WriteLine ("The message with a UID of {0} in {1} is now {2} in {3}",
uid, folder.FullName, uidMap[uid], destination.FullName);
}

jstedfast
- 35,744
- 5
- 97
- 110
-
Thanks for the quick answer :) . Do you have a quick code you could share using the answer `UniqueIdMap`, that would be perfect. – Rui Caramalho Apr 10 '19 at 14:53
-
1A UniqueIdMap is just a dictionary of UID mappings where the key is the original UID and the value is the new UID. See my updated answer and you will say "D'oh! That was so obvious...". – jstedfast Apr 10 '19 at 15:05