inbox.MoveTo Folder does not move message out of inbox

时间:2023-03-09 19:33:20
inbox.MoveTo Folder does not move message out of inbox

inbox.MoveTo Folder does not move message out of inbox #160

 Closed
vnwind opened this issue on 14 Mar 2015 · 3 comments

Comments

Assignees

No one assigned

Labels
Projects

None yet

Milestone

No milestone

2 participants
inbox.MoveTo Folder does not move message out of inboxinbox.MoveTo Folder does not move message out of inbox
inbox.MoveTo Folder does not move message out of inbox

vnwind commented on 14 Mar 2015

Hi I am trying to move a message to a different folder using inbox.MoveTo(uid, matchFolder);. Here is my code:

foreach (var uid in matchedMsgList)
{
var matchFolder = imapClient.GetFolder(folderName);
if (matchFolder != null)
inbox.MoveTo(uid, matchFolder);
}

However, the message shows up on both inbox and matchFolder under outlook. View the message detail and it is label as "Inbox" & "matchFolder"

How can I move the message out of Inbox completely? Or is it has something to do with my outlook program?

Thanks for your help

inbox.MoveTo Folder does not move message out of inbox vnwind changed the title from Move.ToFolder to inbox.MoveTo Folder does not move message out of inbox on 14 Mar 2015

inbox.MoveTo Folder does not move message out of inbox jstedfast added the question label on 14 Mar 2015

inbox.MoveTo Folder does not move message out of inbox

Owner

jstedfast commented on 14 Mar 2015

If you look at the source code for the MoveTo() method, what you'll notice is that there are several code paths depending on the features that the IMAP server supports.

If the IMAP server supports the MOVE extension, then MailKit's MoveTo() method will use the MOVEcommand. I suspect that your server does not support the MOVE command or you probably wouldn't be seeing what you are seeing.

When the IMAP server does not support the MOVE command, MailKit has to use the COPY command to copy the message(s) to the destination folder. Once the COPY command has completed, it will then mark the messages that you asked it to move for deletion by setting the \Deleted flag on those messages.

If the server supports the UIDPLUS extension, then MailKit will attempt to EXPUNGE the subset of messages that it just marked for deletion, however, if the UIDPLUS extension is not supported by the IMAP server, then it cannot safely expunge just that subset of messages and so it simply stops there.

My guess is that your server supports neither MOVE nor UIDPLUS and that is why Outlook continues to see the messages in your folder. I believe, however, that Outlook has a setting to show deleted messages with a strikeout (which you probably have disabled).

So to answer your question more succinctly: After calling folder.MoveTo (...);, if you are confident that the messages marked for deletion should be expunged, call folder.Expunge ();

inbox.MoveTo Folder does not move message out of inbox

Owner

jstedfast commented on 14 Mar 2015

FWIW, if you follow the directions in the FAQ for getting protocol logs, it should show you in more detail what I'm talking about and will confirm (or deny) my explanation.