ImapQuickDownloadMessages Method (String, String, String, String, Int32)
Downloads all the messages (entire messages or message headers only) in the specified folder on the server, in a single line of code.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public static MailMessageCollection QuickDownloadMessages(
	string serverName,
	string accountName,
	string password,
	string folderName,
	int bodyPreviewSize
)

Parameters

serverName
Type: SystemString
The name or IP address of the IMAP4 server.
accountName
Type: SystemString
The user account name on the server.
password
Type: SystemString
The password of the user account on the server.
folderName
Type: SystemString
The full name of the folder to download the messages from.
bodyPreviewSize
Type: SystemInt32
Number of bytes of a message source body to download in addition to a message source header, or -1 to download entire messages, or 0 to download message headers only.

Return Value

Type: MailMessageCollection
A MailMessageCollection object containing the downloaded messages.
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred.
Remarks

This method does not delete any messages in the folder.

An account on the mail server is guaranteed to contain at least "Inbox" folder. The "Inbox" name is case-sensitive ("Inbox", "inbox", and "INBOX" are equivalent). Other folder names, however, may be case-senstive depending on the server implementation.

Since MailBee is capable of downloading multiple messages in a batch, using this method is much more efficient than calling QuickDownloadMessage(String, String, String, String, Int32, Int32) method multiple times.

Note Note
Static methods still require the valid license key be assigned to MailBee.Global.LicenseKey property (by either setting in in the code or in the config file such as app.config). All samples in MailBee documentation assume the license key is already set in the config file.

This method is not async, it's recommended (and in case of UWP platform it's mandatory) to use sync methods like DownloadEnvelopesAsync(String, Boolean, EnvelopeParts, Int32).

Examples
This sample downloads headers of all the messages in the inbox, and displays indices (ordinal positions in the inbox) of all messages which likely have any attachments.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.ImapMail;
using MailBee.Mime;

// The actual code (put it into a method of your class).
MailMessageCollection msgs = Imap.QuickDownloadMessages("mail.company.com", "login", "password", "Inbox", 0);
foreach (MailMessage msg in msgs)
{
    if (msg.HasAttachments)
    {
        Console.WriteLine("Message #" + msg.IndexOnServer +
            " seems to have any attachments");
    }
}
See Also