Send Feedback

The MailSwitchToAccount function switches to the specified account.


HRESULT MailSwitchToAccount(
  LPCTSTR pszAccount, 
  DWORD dwFlags


  • pszAccount
    [in] The account to switch to, in listview. It can be specified either by its name or by the name of the transport, determined by the flag set in the dwFlags parameter.
  • dwFlags
    [in] Flag used to specify whether the pszAccount parameter contains the name of the account or the name of the transport. See MAPI Compose Field Flags for possible values.

Return Values

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

  • S_OK
    The call succeeded.


This function is synchronous. When this function returns, the specified account is shown in listview.


Pocket PC: Windows Mobile Version 5.0 and later
Smartphone: Windows Mobile Version 5.0 and later
OS Versions: Windows CE 5.01 and later
Header: cemapi.h
Library: cemapi.lib

See Also

MAPI Functions | Messaging

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.