ImapDownloadFolders Method |
Downloads the list of all IMAP folders of the mail account.
Namespace: MailBee.ImapMailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public FolderCollection DownloadFolders()
Public Function DownloadFolders As FolderCollection
Return Value
Type:
FolderCollectionFolderCollection object if the folder list was downloaded successfully; otherwise, a null reference (
Nothing in Visual Basic).
Exceptions Remarks If the server supports XLIST or SPECIAL-USE extensions (Gmail does), well-known folder flags like Drafts or Trash will be available.
See
UseXList topic for details.
Examples
This sample downloads the list of all folders of the mail account, and displays them with in user-friendly view
with indentation of folder nesting levels.
using System;
using MailBee;
using MailBee.ImapMail;
class Sample
{
static void Main(string[] args)
{
Imap imp = new Imap();
imp.Connect("mail.server.com");
imp.Login("jdoe", "secret");
FolderCollection folders = imp.DownloadFolders();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (Folder fold in folders)
{
sb.Length = 0;
sb.Append(' ', fold.NestingLevel * 2);
Console.WriteLine(sb.ToString() + fold.ShortName);
}
imp.Disconnect();
}
}
Imports System
Imports MailBee
Imports MailBee.ImapMail
Module Sample
Sub Main(ByVal args As String())
Dim imp As New Imap
imp.Connect("imap4.company.com")
imp.Login("jdoe@company.com", "secret")
Dim folders As FolderCollection = imp.DownloadFolders()
Dim sb As New System.Text.StringBuilder
For Each fold As Folder In folders
sb.Length = 0
sb.Append(" ", fold.NestingLevel * 2)
Console.WriteLine(sb.ToString() & fold.ShortName)
Next
imp.Disconnect()
End Sub
End Module
See Also