CImapClient::SelectMailbox Method  
 
INT SelectMailbox(
  LPCTSTR lpszMailbox,  
  LPIMAPMAILBOX lpMailboxInfo  
);

The SelectMailbox method selects the specified mailbox for read-write access.

Parameters

lpszMailbox
A pointer to a string which specifies the new mailbox to be selected.
lpMailboxInfo
A pointer to an IMAPMAILBOX structure which contains information about the mailbox when the method returns. This parameter may be NULL if the caller does not require any information about the 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 SelectMailbox method 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 UnselectMailbox method 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 SelectMailbox 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 ExamineMailbox 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, ExamineMailbox, GetFirstMailbox, GetMailboxStatus, GetNextMailbox, RenameMailbox, ReselectMailbox, UnselectMailbox