This project is read-only.

Adding/removing message flags

The managemtn of message flags is done directly through adding and removing values to/from the Message.Flags collection. To make it easier, you can use the predefined values for message flags from ImapX.Flags.MessageFlags.

Adding flags

To add one or more message flags, you can us the Add, AddRange methods:

/* .. message = any message .. */  

// add one flag
message.Flags.Add(MessageFlags.Answered); 

// add multiple flags at once
message.Flags.AddRange(new[] { MessageFlags.Answered, MessageFlags.Flagged }); 

Removing flags

To remove one or more message flags, you can us the Remove, RemoveRange methods:

/* .. message = any message .. */  

// remove one flag
message.Flags.Remove(MessageFlags.Answered); 

// remove multiple flags at once
message.Flags.RemoveRange(new[] { MessageFlags.Answered, MessageFlags.Flagged }); 


Important: The RECENT flag (MessageFlags.Recent) is managed by the server only!

Last edited May 1, 2014 at 10:18 AM by pavel_azanov, version 1