+2 votes

Its good that the Move and Copy functions return the new UID of the message in the destination folder.

Currently I am storing the UID, WorkingEmail (which is email and destination uid) in a dictionary, like below.

public IDictionary< long, WorkingMail> CurrentWorkingMailSet { get; set; }

When I try to get the destination UID it always ends up NULL

CurrentWorkingMailSet[uid].DestinationUID = IMapClient.CopyByUID(uid, targetFolder);

Did I understand correctly. That the CopyByUID and MovebyUID return a long of the destination UID?

by (870 points)

1 Answer

+1 vote
 
Best answer

Imap.CopyByUID and Imap.MovebyUID return UID of the new message in destination folder only when UIDPLUS IMAP extension is supported.

You can check if your IMAP server supports this extension by using this code:

bool supportsUIDPlus = client.SupportedExtensions()
    .Contains(ImapExtension.UniqueIdPlus);

If the server is not supporting this extension, there is no way to find the new message UID without issuing search command in the destination folder.

by (301k points)
selected by
Many thanks. Its not supported on hMailServer (the testing server im using). Do you know if its available on Exchange 2010 SP2
Outlook.com and Office365 both support UIDPLUS. Exchange 2003 supports it, Exchange 2007 doesn't, Exchange 2010 RC doesn't, but Exchange 2010 SP2 and SP3 again support it. Exchange 2013 SP1‎ supports it.
...