| MailFolderCount Property |
Get the total number of messages in the folder.
Namespace: MailKitAssembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax public int Count { get; protected set; }
Property Value
Int32The total number of messages.
Implements
IMailFolderCountRemarks Gets the total number of messages in the folder.
Example public static void DownloadMessages ()
{
using (var client = new ImapClient ()) {
client.Connect ("imap.gmail.com", 993, SecureSocketOptions.SslOnConnect);
client.Authenticate ("username", "password");
client.Inbox.Open (FolderAccess.ReadOnly);
for (int index = 0; index < client.Inbox.Count; index++) {
var message = client.Inbox.GetMessage (index);
message.WriteTo (string.Format ("{0}.eml", index));
}
client.Disconnect (true);
}
}
See Also