IAddrBook::SetDefaultDir

Applies to: Outlook 2013 | Outlook 2016

Establishes the specified container as the default address book container.

HRESULT SetDefaultDir(
  ULONG cbEntryID,
  LPENTRYID lpEntryID
);

Parameters

cbEntryID

[in] The byte count in the entry identifier pointed to by the lpEntryID parameter.

lpEntryID

[in] A pointer to the entry identifier of the default address book container.

Return value

S_OK

The default address book container was successfully set.

Remarks

Clients and service providers call the SetDefaultDir method to establish a new default address book container. The default container is the container that the user sees displayed in the address book when the address book is first opened. SetDefaultDir saves the default container as an entry in the profile. The container remains as the default until either another call to SetDefaultDir is made in the same session or in another session, or the container is removed.

Note

The PR_AB_CHOOSE_DIRECTORY_AUTOMATICALLY property corresponds to the Choose automatically setting in the Address Book Options dialog. When this property exists in the IID_CAPONE_PROF profile section and is set to true, the Address Book dialog no longer defaults to the container specified by SetDefaultDir, but chooses an address book that Microsoft Outlook considers appropriate for the context in which the dialog was displayed. Note that this may result in a poor experience for third-party address book providers.

MFCMAPI reference

For MFCMAPI sample code, see the following table.

File Function Comment
Abcontdlg.cpp
CAbContDlg::OnSetDefaultDir
MFCMAPI uses the SetDefaultDir method to make the specified address book container the default one.

See also

IAddrBook::GetDefaultDir

IAddrBook::GetSearchPath

IMAPISession::Logoff

MAPILogonEx

IAddrBook : IMAPIProp

MFCMAPI as a Code Sample