set mail to unread mail

Oct 12, 2012 at 9:08 AM

 I don't understand how to make mail status to unread.

Please help me

Coordinator
Oct 15, 2012 at 11:51 AM

At first, see this post.
http://higlabo.codeplex.com/discussions/354106

Pop3 does not have read state management, but Imap has it.
Which protocol do you use?

Oct 15, 2012 at 12:04 PM
Edited Oct 15, 2012 at 12:13 PM

I use imap protol and I saw this sample. 

My code:

Dim list As SearchResult = cl.ExecuteSearch("UNSEEN UNDELETED")

For i As Integer = 0 To list.MailIndexList.Count - 1     
  Dim mg = cl.GetMessage(list.MailIndexList(i))    
Next

All OK, but function GetMessage set read status to True, but I want to leave the status as is("unseen" at this sample).

Coordinator
Oct 15, 2012 at 12:19 PM

Hi.
Please try ExecuteStore method.

cl.ExecuteStore(mailIndex, StoreItem.FlagsRemove, "UNSEEN");

regards

Oct 15, 2012 at 1:50 PM

Hi!

Thank you very much for idea!!!

cl.ExecuteStore(mailIndex, StoreItem.FlagsRemove, "UNSEEN");  - doesn't work

but cl.ExecuteStore(mailIndex, StoreItem.FlagsReplace, "UNSEEN") -  work  :))))))))))))))))))))))))))

Coordinator
Oct 15, 2012 at 11:57 PM

Thank you for your feed back.
I'll add this information about read state to document wiki.