ImapCheckMailbox Function  
 
INT WINAPI ImapCheckMailbox(
  HCLIENT hClient,  
  UINT *lpnMessages,  
  UINT *lpnUnseen  
);

The ImapCheckMailbox function requests that the server create a checkpoint of the currently selected mailbox, and returns the current number of messages and unseen messages.

Parameters

hClient
Handle to the client session.
lpnMessages
A pointer to an unsigned integer value which will contain the number of messages in the currently selected mailbox when the function returns.
lpnUnseen
A pointer to an unsigned integer value which will contain the number of unseen messages in the currently selected mailbox.

Return Value

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

Remarks

When the client requests a checkpoint, the server may perform implementation-dependent housekeeping for that mailbox, such updating the mailbox on disk with the current state of the mailbox in memory. On some systems this command has no effect other than to update the client with the current number of messages in the mailbox.

This function actually sends two IMAP commands. The first is the CHECK command, followed by the NOOP command to poll for any new messages that have arrived. In addition to polling the server for new messages, this command can also be used to ensure the idle timer on the server does not expire and force a disconnect from the client.

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.

See Also

ImapCreateMailbox, ImapGetFirstMailbox, ImapGetMailboxStatus, ImapGetNextMailbox, ImapRenameMailbox