CImapClient::GetNextMailbox Method  
 
INT GetNextMailbox(
  LPTSTR lpszMailbox,  
  INT nMaxLength  
  LPDWORD lpdwFlags  
);
INT GetNextMailbox(
  CString& strMailbox,  
  LPDWORD lpdwFlags  
);

The GetNextMailbox method returns the name of the next matching mailbox.

Parameters

lpszMailbox
A pointer to a 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 method succeeds, it returns the length of the mailbox name. If an error occurs, the method returns IMAP_ERROR. To get extended error information, call GetLastError.

Remarks

The GetNextMailbox method returns the next matching mailbox name. When the last mailbox has been returned, the next call to this method 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 SubscribeMailbox method. 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 GetFirstMailbox method.

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csmapv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

DeleteMailbox, GetFirstMailbox, GetMailboxStatus, RenameMailbox, SelectMailbox