<<< Previous |  | Next >>>

# mail::ACCOUNT::getTopLevelFolders

## Name

mail::ACCOUNT::getTopLevelFolders -- Enumerate top-level folders

## Synopsis

#include <libmail/sync.H>
mail::ACCOUNT *mail;
mail::ACCOUNT::FolderList folderList;

``bool ok=mail->`getTopLevelFolders``(`folderList`);`

std::string errmsg=mail->getErrmsg();

size_t nFolders=folderList::size();
const mail::folder *folder=folderList[n];

## USAGE

A mail account contains a collection of folders, arranged in a top-to-bottom hierarchy. This function returns the list of the folders at the top-level of the folder hierarchy.

`mail::ACCOUNT::getTopLevelFolders`, if succesful, initializes a list of `mail::folder` objects, which are maintained by the `mail::ACCOUNT::FolderList` class. Each `mail::folder` object represents a mail account's folder. The number of folders, and a pointer to each folder object, is obtained according to the example above.

NOTE: | Pointers to `mail::folder` objects are no longer valid after the `mail::ACCOUNT::FolderList` object is destroyed. The application should use mail::folder::clone(3x) to create a duplicate copy of the `mail::folder` object (which the application is now responsible for destroying).

## RETURN CODES AND CALLBACKS

This method returns `true` if it succeeds, or `false` if it fails. If the method fails, use `mail::ACCOUNT::getErrmsg()` to read a brief description of the error.

## SEE ALSO

mail::ACCOUNT::login(3x), mail::ACCOUNT::getSubFolders(3x).

<<< Previous | Home | Next >>>
mail::ACCOUNT::getSubFolders | Up | mail::ACCOUNT::login