ImapGetSpecialFolder Method
Gets a reference to the special folder of the specified kind.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public Folder GetSpecialFolder(
	FolderCollection folders,
	FolderFlags flag
)

Parameters

folders
Type: MailBee.ImapMailFolderCollection
A reference to the list of all folders in the IMAP account.
flag
Type: MailBee.ImapMailFolderFlags
The special folder kind.

Return Value

Type: Folder
A reference to the special folder, or a null reference (Nothing in Visual Basic) if no such folder was found in the provided list.
Remarks

This method itself does not make any network queries, it operates on an already retrieved folder list. To get the folder list, use DownloadFolders method.

Once you got the folder, you can use its Name for other operations (like SelectFolder(String), UploadMessage(MailMessage, String, String, String, Boolean, UidPlusResult), etc). Or, if you need to deal with international folder names, it's better to set Utf7EncodeFolderNames to false and pass RawName instead

Note Note
If the server does not support special folder flags, this method can be useless. The IMAP server must support SPECIAL-USE or XLIST extension for this to work.
Examples
This sample downloads the folders, then finds Sent Items folder and uploads a message there.
using System;
using MailBee;
using MailBee.Mime;
using MailBee.ImapMail;

class Sample
{
    static void Main(string[] args)
    {
        Imap imp = new Imap();

        // Logging is cool for debugging.
        imp.Log.Enabled = true;
        imp.Log.Filename = @"C:\Temp\log.txt";
        imp.Log.Clear();

        // Connect/login.
        imp.Connect("imap.server.com");
        imp.Login("user@domain", "password");

        // Create a message and fill it with some values (omitted for brevity).
        MailMessage msg = new MailMessage();

        // Get folders.
        FolderCollection fc = imp.DownloadFolders();

        Folder f = imp.GetSpecialFolder(fc, FolderFlags.Sent);
        if (f != null)
        {
            // Upload a message into Sent Items folder. Folder names can be international.
            imp.Utf7EncodeFolderNames = false;
            imp.UploadMessage(msg, f.RawName, SystemMessageFlags.Seen);
        }
        imp.Disconnect();
    }
}
See Also