Flagging messages as unseen fails

Jan 23, 2012 at 10:52 PM

Hi I am trying to flag the messages as unseen but it is failing with the following error:

ActiveUp.Net.Mail.Imap4Exception: Command "store 1 +flags (\unseen)" failed : 120124124813323 BAD Command Argument Error. 11

What am i trying to achieve?
I am writing an application which retrieves data from an email account and does some processing on it.During processing of data if there are any failures than I want to leave the message as unread so that it is processed the next time the application runs.

Simple code I am using - (i am excluding the connection and login details here to keep things simple. Those are working as I am able to retrieve read or unread emails)

Dim flags As New FlagCollection
flags.Add(New Flag("unseen"))
_inbox.AddFlags(1, flags)

Cheers, Neil.

Apr 3, 2012 at 10:11 PM

Don't add the 'unseen' flag -- remove the 'seen' flag.

FlagCollection flags = new FlagCollection();
flags.Add("Seen");
mbx.RemoveFlags(msg.IndexOnServer, flags);