ImapGetNextMailbox Function  
 
INT WINAPI ImapGetNextMailbox(
  HCLIENT hClient,  
  LPTSTR lpszMailbox,  
  INT nMaxLength  
  LPDWORD lpdwFlags  
);

The ImapGetNextMailbox function returns the name of the next matching mailbox.

Parameters

hClient
Handle to the client session.
lpszMailbox
A pointer to a null-terminated string buffer which will contain the next matching mailbox. This parameter cannot be NULL. A minimum buffer size of at least 128 character is recommended.
nMaxLength
Specifies the maximum length of the string buffer. The maximum length of the buffer should be large enough to accommodate most path names on the IMAP server.
lpdwFlags
A pointer to an unsigned integer which will contain the mailbox flags for the next matching mailbox. This parameter may be NULL, in which case the mailbox flags are not returned. Otherwise, one or more of the following bit flags may be returned:
Constant Description
IMAP_FLAG_NOINFERIORS The mailbox does not contain any sub-mailboxes. In the IMAP protocol, these are referred to as inferior hierarchical mailbox names.
IMAP_FLAG_NOSELECT The mailbox cannot be selected or examined. This flag is typically used by servers to indicate that the mailbox name refers to a directory on the server, not a mailbox file.
IMAP_FLAG_MARKED The mailbox is marked as being of interest to a client. If this flag is used, it typically means that the mailbox contains messages. An application should not depend on this flag being present for any given mailbox. Some IMAP servers do not support marked or unmarked flags for mailboxes.
IMAP_FLAG_UNMARKED The mailbox is marked as not being of interest to a client. If this flag is used, it typically means that the mailbox does not contain any messages. An application should not depend on this flag being present for any given mailbox. Some IMAP servers do not support marked or unmarked flags for mailboxes.

Return Value

If the function succeeds, it returns the length of the mailbox name. If an error occurs, the function returns IMAP_ERROR. To get extended error information, call ImapGetLastError.

Remarks

The ImapGetNextMailbox function returns the next matching mailbox name. When the last mailbox has been returned, the next call to this function will result in an error, with the last error code set to ST_ERROR_NO_MORE_MAILBOXES.

Subscribed mailboxes are those which were specified using the ImapSubscribeMailbox function. Marked mailboxes are typically those which have some special importance to the user.

For more information about enumerating the available mailboxes on the IMAP server, refer to the ImapGetFirstMailbox function.

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csmapav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

ImapDeleteMailbox, ImapGetFirstMailbox, ImapGetMailboxStatus, ImapRenameMailbox, ImapSelectMailbox