ImapDownloadFolders Method (Boolean) |
Downloads the list of 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(
bool subscribedOnly
)
Public Function DownloadFolders (
subscribedOnly As Boolean
) As FolderCollection
Parameters
- subscribedOnly
- Type: SystemBoolean
If true, only subscribed folders will be downloaded; otherwise, all the folders.
Return Value
Type:
FolderCollectionFolderCollection object if the folder list was downloaded successfully; otherwise, a null reference (
Nothing in Visual Basic).
Exceptions Remarks
If
subscribedOnly is
false,
UseXList is
true and the server supports XLIST extension, extended folder flags like Drafts or Trash will be available.
See
UseXList topic for details.
Note |
---|
If the server supports SPECIAL-USE IMAP extension (Gmail does), extended flags will be available in all modes (both "list all folders" and "list subscribed-only folders"),
even if UseXList is disabled. |
Examples
This sample downloads the list of all subscribed folders of the mail account, and displays their full names.
using System;
using MailBee;
using MailBee.ImapMail;
class Sample
{
static void Main(string[] args)
{
Imap imp = new Imap();
imp.Connect("mail.company.com");
imp.Login("jdoe@company.com", "secret");
FolderCollection folders = imp.DownloadFolders(true);
foreach (Folder fold in folders)
{
Console.WriteLine(fold.Name);
}
imp.Disconnect();
}
}
Imports System
Imports MailBee
Imports MailBee.ImapMail
Module Sample
Sub Main()
Dim imp As New Imap
imp.Connect("imap4.company.com")
imp.Login("jdoe@company.com", "secret")
Dim folders As FolderCollection = imp.DownloadFolders(True)
For Each fold As Folder In folders
Console.WriteLine(fold.Name)
Next
imp.Disconnect()
End Sub
End Module
See Also