Mark a Message as Flagged

The following example demonstrates marking a message as Flagged. Flagging a message simply sets the \flagged flag, and does not do anything to the message internally. This flag can be used by the end developer to simply designate a message.

[C#]

IMAP4 imap = new IMAP4( "127.0.0.1", "dave@blah.com", "test"  );  
 
//set some logging properties  
imap.Logger = new IMAPLog(); 
imap.Logger.Overwrite = true; 
imap.Logger.InMemory = true; 
imap.Logger.Path = "c:\\imap.log"; 
 
 
imap.Login();  
 
MailFolder inbox = imap.SelectInbox();  
MessageClient mc = inbox.MessageClient;  
 
 
//mark with flag
mc.MarkAsFlagged( 1, IndexType.Ordinal ); 
 
imap.Disconnect();  
 
//write out the log 
Console.WriteLine( imap.Logger.ToString() ); 
 
Console.WriteLine( "Done" );  
Console.ReadLine();

 

[VB.NET]

Dim imap As New IMAP4("127.0.0.1", "dave@blah.com", "test")
 
'set some logging properties  
imap.Logger = New IMAPLog()
imap.Logger.Overwrite = True
imap.Logger.InMemory = True
imap.Logger.Path = "c:\imap.log"
 
 
imap.Login()
 
Dim inbox As MailFolder = imap.SelectInbox()
Dim mc As MessageClient = inbox.MessageClient
 
 
'mark with flag
mc.MarkAsFlagged(1, IndexType.Ordinal)
 
imap.Disconnect()
 
'write out the log 
Console.WriteLine(imap.Logger.ToString())
 
Console.WriteLine("Done")
Console.ReadLine()