CImapClient::SubscribeMailbox Method  
 
INT SubscribeMailbox(
  LPCTSTR lpszMailbox  
);

The SubscribeMailbox method subscribes the user to the specified mailbox.

Parameters

lpszMailbox
A null-terminated string which specifies the mailbox to subscribe to.

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 SubscribeMailbox method adds the specified mailbox to the current user's list of active or subscribed mailboxes. The user will remain subscribed to the mailbox across multiple sessions, until the UnsubscribeMailbox method is called to remove the mailbox from the subscription list.

To list those mailboxes which the user has subscribed to, use the GetFirstMailbox method and specify the IMAP_LIST_SUBSCRIBED option.

Note that if a user subscribes to a mailbox and that mailbox is later renamed or deleted, the mailbox will not be automatically removed from the user's subscription list. An application must not assume that because a mailbox name is included in the list of subscribed mailboxes, it exists and can be selected. To check if the mailbox exists, use the GetMailboxStatus method.

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