Partager via


MailSwitchToFolder

4/8/2010

The MailSwitchToFolder function switches to a folder, and displays its contents in a List-View. For more information about the List View control, see the List-View Controls Reference.

Syntax

HRESULT MailSwitchToFolder(
    LPENTRYID lpEntryID,
    ULONG cbEntryID
);

Parameters

  • lpEntryID
    [in] Reference to the ENTRYID of the folder to display in a List View.
  • cbEntryID
    [in] Size of the ENTRYID structure, in bytes.

Return Value

This function returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

  • S_OK
    The function call succeeded.

Remarks

Because folder names may not be unique across different accounts, the folder must be specified by ENTRYID instead of by name. If there is no folder with the specified ENTRYID, this function will return an error.

This function is synchronous. When this function returns, the specified folder is shown in list-view.

If you do not have a message store pointer, you can get an ENTRYID to pass into MailSwitchToFolder using the ICEMAPISession pointer. The IMAPISession::GetMsgStoresTable returns a list of message stores. You can use IMsgStore::GetReceiveFolder on the IMsgStore interface to get the EntryID of the Inbox associated with the message store you want. If you want another folder, query the message store for properties such as PR_IPM_OUTBOX_ENTRYID, PR_IPM_WASTEBASKET_ENTRYID, and PR_IPM_SENTMAIL_ENTRYID. Alternatively, you can use MAPI methods to walk the Inbox hierarchy to child folders.

Requirements

Header cemapi.h
Library cemapi.lib
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also

Reference

MAPI Functions
PR_ENTRYID
IMAPISession::GetMsgStoresTable

Other Resources

Messaging