Managing The Outlook Account Management Dialogs

[This is now documented here: https://msdn.microsoft.com/en-us/library/ff976789.aspx]

We've decided to document another function in the Account Management API, DisplayAccountList. This function allows you to display the Account Settings dialog:

Account Settings

and Add New E-Mail Account property sheet:

Add New E-mail Account

DisplayAccountList hangs off of IOlkAccountManager interface, occupying the second slot in the v-table, like so:

 interface IOlkAccountManager : IOlkErrorUnknown
{
public:
    //Init Initializes the account manager for use. 
    virtual STDMETHODIMP Init(IOlkAccountHelper* pAcctHelper, DWORD dwFlags);
    
    //DisplayAccountList Displays the account list wizard
    virtual STDMETHODIMP DisplayAccountList(
        HWND hwnd,
        DWORD dwFlags,
        LPCWSTR lpwszReserved, // Not used
        DWORD dwReserved, // Not used
        const CLSID * pclsidReserved1, // Not used
        const CLSID * pclsidReserved2); // Not used

I'm working on a little sample to demonstrate the Account Manager API that I hope to post soon. It'll have an updated header. In the meantime, here's my attempt at MSDN style documentation for the function:

IOlkAccountManager::DisplayAccountList

Initializes the account manager for use.

Quick Info

See IOlkAccountManager.

 HRESULT IOlkAccountManager::DisplayAccountList ( 
    HWND hwnd,
    DWORD dwFlags,
    LPCWSTR lpwszReserved,
    DWORD dwReserved,
    const CLSID * pclsidReserved1,
    const CLSID * pclsidReserved2
);

Parameters

hwnd

[in] Handle to the window to which the displayed dialog box is modal. This parameter can be zero.

dwFlags

[in] Flags to modify behavior.

ACCTUI_NO_WARNING

Do not display the warning that changes will not take effect until Outlook is restarted. Only applies if running in process with Outlook.exe.

ACCTUI_SHOW_DATA_TAB

Show the Account Settings dialog with the Data tab selected. Only valid if ACCTUI_SHOW_ACCTWIZARD is not set.

ACCTUI_SHOW_ACCTWIZARD

Display the Add New E-Mail Account wizard.

lpwszReserved,

[in] Not used. Should be NULL.

dwReserved

[in] Not used. Must be NULL.

pclsidReserved1

[in] Not used. Must be NULL.

pclsidReserved2

[in] Not used. Must be NULL.

Return Values

S_OK

The call was successful.

E_OLK_NOT_INITIALIZED

The account manager has not been initialized for use.

MAPI_E_INVALID_PARAMETER

dwReserved, pclsidReserved1 or pclsidReserved2 were non-NULL.

E_ACCT_UI_BUSY

The account dialog class could not be created.

MAPI_E_USER_CANCEL

The Account Settings dialog box returned an error.

MAPI_E_CALL_FAILED

The Add New E-Mail property sheet returned an error.

Remarks

The client calls IOlkAccountManager::DisplayAccountList to display either the Account Settings dialog or the Add New E-mail property sheet. The parameters dwReserved, pclsidReserved1 and pclsidReserved2 are not used at this time and MUST be NULL. The parameter lpwszReserved is not used and SHOULD be NULL.

Constants

 #define E_ACCT_UI_BUSY 0x800C8102
#define ACCTUI_NO_WARNING      0x0100
#define ACCTUI_SHOW_DATA_TAB   0x0200
#define ACCTUI_SHOW_ACCTWIZARD 0x0400

BTW - Hey look! Pictures! Woo hoo!

7/3/08 - Update: Added ACCTUI_SHOW_DATA_TAB flag.