Folder list as XML

The following example demonstrates using aspNetIMAP to output a list of Folders to XML.

[C#]

IMAP4 imap = new IMAP4( "127.0.0.1" );
 
imap.Username = "dave@blah.com";
imap.Password = "test";
imap.Login();
 
//list all of the folders
MailFolderCollection mfc = imap.FolderList();
 
imap.Disconnect();
 
//write out the collection as a string
Console.WriteLine( mfc.ToXmlString() );
 
Console.WriteLine( "Done" );
Console.ReadLine();

 

[VB.NET]

Dim imap As New IMAP4("127.0.0.1")
 
imap.Username = "dave@blah.com"
imap.Password = "test"
imap.Login()
 
'list all of the folders
Dim mfc As MailFolderCollection = imap.FolderList()
 
imap.Disconnect()
 
'write out the collection as a string
Console.WriteLine(mfc.ToXmlString())
 
Console.WriteLine("Done")
Console