CImapClient::GetMailboxStatus Method  
 
INT GetMailboxStatus(
  LPCTSTR lpszMailbox,  
  LPIMAPMAILBOXSTATUS lpMailboxStatus  
);

The GetMailboxStatus method returns status information about the specified mailbox.

Parameters

lpszMailbox
A null-terminated string that specifies the mailbox to return information about.
lpMailboxStatus
A pointer to an IMAPMAILBOXSTATUS structure which contains status information about the specified mailbox.

Return Value

If the method succeeds, it returns zero. If an error occurs, the method returns IMAP_ERROR. To get extended error information, call GetLastError.

Remarks

The GetMailboxStatus method enables an application to obtain status information about a mailbox without having to select another mailbox or open a second connection to the IMAP server to examine the mailbox. The information returned is a subset of the information returned when a mailbox is selected.

If you need to check the status of a mailbox which contains Unicode characters or symbols, it is recommended you use the Unicode character set when compiling your application. The mailbox name will automatically be converted to modified UTF-7 encoding as defined by the IMAP4 standard. If you do not use Unicode, this method will only accept mailbox names using modified UTF-7 encoding or UTF-8 encoding.

Note that obtaining status information for a mailbox may be a slow operation. It may require that server open the mailbox in read-only mode internally in order to obtain some of the status information. For this reason, this method should not be used to check for new messages; use the CheckMailbox method instead.

Some IMAP servers may return an error if you attempt to obtain status information about the currently selected mailbox. The protocol standard states that clients should not use this method on the currently selected mailbox, and should instead use the information returned by the SelectMailbox or ExamineMailbox methods.

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