ImapSelectMailbox Function  
 
INT WINAPI ImapSelectMailbox(
  HCLIENT hClient,  
  LPCTSTR lpszMailbox,  
  LPIMAPMAILBOX lpMailboxInfo  
);

The ImapSelectMailbox function selects the specified mailbox for read-write access.

Parameters

hClient
Handle to the client session.
lpszMailbox
A pointer to a null-terminated string which specifies the new mailbox to be selected.
lpMailboxInfo
A pointer to an IMAPMAILBOX structure which contains information about the mailbox when the function returns. This parameter may be NULL if the caller does not require any information about the 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

The ImapSelectMailbox function is used to select a mailbox in read-write mode. If the client has a different mailbox currently selected, that mailbox will be closed and any messages marked for deletion will be expunged. To prevent deleted messages from being removed from the previous mailbox, use the ImapUnselectMailbox function prior to selecting the new mailbox.

If an application wishes to update the information returned in the IMAPMAILBOX structure for the current mailbox, simply call ImapSelectMailbox again with the same mailbox name. Note that this will not cause any messages marked for deletion to be expunged.

The special case-insensitive mailbox name INBOX is used for new messages. Other mailbox names may or may not be case-sensitive depending on the IMAP server's operating system and implementation.

To access a mailbox in read-only mode, use the ImapExamineMailbox 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, ImapExamineMailbox, ImapGetFirstMailbox, ImapGetMailboxStatus, ImapGetNextMailbox, ImapRenameMailbox, ImapReselectMailbox, ImapUnselectMailbox