Archived Forum Post

Index of archived forum posts


Can Imap.ListMailboxes return all mailboxes?

Nov 27 '12 at 20:07

Does ListMailboxes always return all the IMAP mailboxes? Or do I need to recurse using references?


To return all mailboxes in the hierarchy, pass arguments as shown here:

    // Get the mailboxes.
    Chilkat.Mailboxes mboxes = imap.ListMailboxes("", "*");
    if (mboxes == null)

int i;
int n = mboxes.Count;
for (i=0; i<n; i++)
    // Add the mailbox name to a listBox.

The two arguments to the ListMailboxes method are passed directly to the IMAP server. Therefore, the method behaves exactly as specified by the IMAP RFC 3501. (The section of the RFC is duplicated in the Chilkat reference documentation for the ListMailboxes method.)