CImapClient::GetMessageCount Method  
 
INT GetMessageCount(
  UINT *lpnLastMessage,  
  DWORD *lpdwMailboxSize  
);

The GetMessageCount method returns the number of messages that are available in the currently selected mailbox, and optionally the size of the mailbox in bytes.

Parameters

lpnLastMessage
Address of a variable that receives the number of the last valid message in the mailbox. If a NULL value is specified, this argument is ignored.
lpdwMailboxSize
Address of a variable that receives the current size of the mailbox. If a NULL value is specified, this argument is ignored.

Return Value

If the method succeeds, it returns the number of messages that are currently available. If no messages are available, this method will return zero. If the method fails, the return value is IMAP_ERROR. To get extended error information, call GetLastError.

Remarks

The GetMessageCount method is provided for compatibility with the POP3 class. The lpnLastMessage parameter will always contain the same value returned by the method since there is no distinction between the message count and the last available message. This is because messages that are marked for deletion on an IMAP server can still be accessed until the mailbox is expunged or unselected. This differs from the POP3 protocol, where messages cannot be accessed once they have been marked for deletion.

If the lpdwMailboxSize parameter is specified, this method will call GetMailboxSize to determine the size of the currently selected mailbox. Unlike the POP3 protocol, calculating the mailbox size may require a significant amount of time if there are a large number of messages in the mailbox. It is not recommended that an application request the mailbox size unless it is absolutely necessary.

Requirements

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

See Also