Folder Flags

IMAP supports folder flags; they can provide you with additional information about a folder, such as if a folder is selected, if it has any subfolders, etc.

GemBox.Email represents each folder's flags with a read-only ImapFolderInfo.Flags collection. The possible flags that can occur are listed as an ImapFolderFlag enumeration.

The example shows how to list folders and their flags.

Folder flags with IMAP client in C# and VB.NET
Screenshot of folder flags from ImapClient
using System;
using System.Collections.Generic;
using GemBox.Email;
using GemBox.Email.Imap;

class Program
    static void Main()
        // If using the Professional version, put your serial key below.

        using (ImapClient imap = new ImapClient("<ADDRESS> (e.g."))
            imap.Authenticate("<USERNAME>", "<PASSWORD>");

            // Select INBOX folder.

            // List INBOX folder flags.
            IList<ImapFolderInfo> folders = imap.ListFolders();
            foreach (string flag in imap.SelectedFolder.Flags)
Imports System
Imports System.Collections.Generic
Imports GemBox.Email
Imports GemBox.Email.Imap

Module Program

    Sub Main()

        ' If using the Professional version, put your serial key below.

        Using imap As New ImapClient("<ADDRESS> (e.g.")

            imap.Authenticate("<USERNAME>", "<PASSWORD>")

            ' Select INBOX folder.

            ' List INBOX folder flags.
            Dim folders As IList(Of ImapFolderInfo) = imap.ListFolders()
            For Each flag As String In imap.SelectedFolder.Flags
        End Using
    End Sub
End Module

For more information about ImapClient, check out our IMAP Client Connection example.

See also

Next steps

GemBox.Email is a .NET component that enables you to read, write, receive, and send emails from your .NET applications using one simple API.

Download Buy