Provides properties and methods for presenting an IMAP4/MS Exchange mail folder.
        System.Object
            EAGetMail.Imap4Folder
    
[Visual Basic] Public Class Imap4Folder
[C#] public class Imap4Folder
[C++] public ref class Imap4Folder
[JScript] public class Imap4Folder
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Public Constructors
| Imap4Folder Constructor | Initializes a new instance of the Imap4Folder class. | 
Public Properties
| FullPath | Gets full path of IMAP4/Exchange folder. | 
| IMAP4FolderFlags | Gets the flags of IMAP4 folder. | 
| LocalPath | Gets the full path of IMAP4/Exchange folder based on local directory syntax. | 
| Name | Gets the name of IMAP4/Exchange folder. | 
| SubFolders | Gets the sub-folders of current folder. | 
| Subscribed | Gets whether the IMAP4 folder has been subscribed. | 
Example
[Visual Basic, C#, C++] The following sample demonstrates how to enumerate all folders on IMAP4/MS Exchange server. To get the full samples of EAGetMail, please refer to Samples section.
[Visual Basic - Enumerate Mail Folders]
Imports EAGetMail
Public Sub ConnectImap4Server( _
ByVal server As String, _
ByVal user As String, _
ByVal password As String, _
ByVal sslConnection As Boolean)
    
    ' To manage folder with Exchange Web Service, please change
    ' ServerProtocol.Imap4 to ServerProtocol.ExchangeEWS to MailServer constructor
    ' and also set sslConnection to True
    ' To manage folder with Exchange WebDAV, please change
    ' ServerProtocol.Imap4 to ServerProtocol.ExchangeWebDAV to MailServer constructor
    ' Exchange Server supports IMAP4 protocol as well, but in Exchange 2007
    ' or later version, IMAP4 service is disabled by default. If you don't want to use IMAP4
    ' to manage folder from Exchange Server, you can use Exchange Web Service (Exchange 2007/2010 or
    ' later version) or WebDAV (Exchange 2000/2003) protocol.
    
    
    Try
        Dim oServer As New MailServer(server, user, password, sslConnection, _
            ServerAuthType.AuthLogin, ServerProtocol.Imap4)
        Dim oClient As New MailClient("TryIt")
        oClient.Connect(oServer)
        Dim folders() As Imap4Folder = oClient.Imap4Folders
        ' enumerates all folders on IMAP4/Exchange server.
        EnumerateFolder(folders)
        oClient.Logout()
    Catch ep As Exception
        oClient.Close()
        Console.WriteLine(ep.Message)
    End Try
End Sub
Public Sub EnumerateFolder(ByVal folders() As Imap4Folder)
    For i As Integer = 0 To folders.Length - 1
        Dim folder As Imap4Folder = folders(i)
        
        Console.WriteLine("Name: {0}", folder.Name)
        Console.WriteLine("FullPath: {0}", folder.FullPath)
        Console.WriteLine("LocalPath: {0}", folder.LocalPath)
        Console.WriteLine("Flags: {0}", folder.IMAP4FolderFlags)
        Console.WriteLine("Subscribed: {0}" & vbCrLf, folder.Subscribed)
        EnumerateFolder(folder.SubFolders)
    Next
End Sub
[C# - Enumerate Mail Folders]
using System;
using EAGetMail;
public static void ConnectImap4Server(
    string server,
    string user,
    string password,
    bool sslConnection)
{
    
    // To manage folder with Exchange Web Service, please change
    // ServerProtocol.Imap4 to ServerProtocol.ExchangeEWS to MailServer constructor
    // and also set sslConnection to true
    // To manage folder with Exchange WebDAV, please change
    // ServerProtocol.Imap4 to ServerProtocol.ExchangeWebDAV to MailServer constructor
    // Exchange Server supports IMAP4 protocol as well, but in Exchange 2007
    // or later version, IMAP4 service is disabled by default. If you don't want to use IMAP4
    // to manage folder from Exchange Server, you can use Exchange Web Service (Exchange 2007/2010 or
    // later version) or WebDAV (Exchange 2000/2003) protocol.
    
    try
    {
        MailServer oServer = new MailServer(server, user, password, sslConnection,
        ServerAuthType.AuthLogin, ServerProtocol.Imap4);
        MailClient oClient = new MailClient("TryIt");
        oClient.Connect(oServer);
        Imap4Folder [] folders = oClient.Imap4Folders;
        // enumerates all folders on IMAP4 server.
        EnumerateFolder(folders);
        
        oClient.Logout();
    }
    catch(Exception ep)
    {
        oClient.Close();
        Console.WriteLine(ep.Message);
    }
}
public static void EnumerateFolder(
    Imap4Folder[] folders)
{
    for(int i = 0; i < folders.Length; i++)
    {
        Imap4Folder folder = folders[i];
        Console.WriteLine("Name: {0}", folder.Name);
        Console.WriteLine("FullPath: {0}", folder.FullPath);
        Console.WriteLine("LocalPath: {0}", folder.LocalPath);
        Console.WriteLine("Flags: {0}", folder.IMAP4FolderFlags);
        Console.WriteLine("Subscribed: {0}\r\n", folder.Subscribed);
        EnumerateFolder(folder.SubFolders);
    }
}
[C++/CLI - Enumerate Mail Folders]
using namespace System;
using namespace EAGetMail;
Void EnumerateFolder(
    array<Imap4Folder^>^folders)
{
    for(int i = 0; i < folders->Length; i++)
    {
        Imap4Folder ^folder = folders[i];
        Console::WriteLine("Name: {0}", folder->Name);
        Console::WriteLine("FullPath: {0}", folder->FullPath);
        Console::WriteLine("LocalPath: {0}", folder->LocalPath);
        Console::WriteLine("Flags: {0}", folder->IMAP4FolderFlags);
        Console::WriteLine("Subscribed: {0}\r\n", folder->Subscribed);
        EnumerateFolder(folder->SubFolders);
    }
}
Void ConnectImap4Server(
    String^ server,
    String^ user,
    String^ password,
    bool sslConnection)
{
    
    // To manage folder with Exchange Web Service, please change
    // ServerProtocol::Imap4 to ServerProtocol::ExchangeEWS to MailServer constructor
    // and also set sslConnection to true
    // To manage folder with Exchange WebDAV, please change
    // ServerProtocol::Imap4 to ServerProtocol::ExchangeWebDAV to MailServer constructor
    // Exchange Server supports IMAP4 protocol as well, but in Exchange 2007
    // or later version, IMAP4 service is disabled by default. If you don't want to use IMAP4
    // to manage folder from Exchange Server, you can use Exchange Web Service (Exchange 2007/2010 or
    // later version) or WebDAV (Exchange 2000/2003) protocol.
    
    try
    {
        MailServer ^oServer = gcnew MailServer(server, user, password, sslConnection,
        ServerAuthType::AuthLogin, ServerProtocol::Imap4);
        MailClient ^oClient = gcnew MailClient("TryIt");
        oClient->Connect(oServer);
        array<Imap4Folder^>^folders = oClient->Imap4Folders;
        //enumerates all folders on IMAP4/Exchange server.
        EnumerateFolder(folders);
        
        oClient->Logout();
    }
    catch(Exception ^ep)
    {
        oClient->Close();
        Console::WriteLine(ep->Message);
    }
}
    See Also
        MailClient.Imap4Folders Property
        MailClient.CreateFolder Method
        MailClient.DeleteFolder Method
        MailClient.Move Method
        MailClient.Copy Method
        MailClient.SelectFolder Method
    
Online Tutorials
        Manage Mail Folders in C#
        Manage Mail Folders in VB
        Manage Mail Folders in C++/CLI