Working with message flags

ImapX allows you to manage message flags. First of all, make sure the flags are downloaded.

Making sure the message flags are being requested

If you didn't make any changes to ImapClient.Behavior.MessageFetchMode or set it to MessageFetchMode.Tiny, MessageFetchMode.Minimal, MessageFetchMode.Basic or MessageFetchMode.Full, no changes are required.

Otherwise, you can configure the client to always download flags:

client.Behavior.MessageFetchMode = client.Behavior.MessageFetchMode | MessageFetchMode.Flags

Or download them separately when using Folder.Search, MessageCollection.Download or Message.Download methods:

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


/ * .. or .. */


/* .. or .. */

folder.Search("ALL", MessageFetchMode.Flags);

Checking which flags are set

In order to check which flags are set, enumerate through the Message.Flags collection:

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

To make it easier, you can use the predefined values of flags in ImapX.Flags.MessageFlags