IAddrBook::SetDefaultDir

Applies to: Office 2010 | Outlook 2010 | Visual Studio

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

Reference

IAddrBook::GetDefaultDir

IAddrBook::GetSearchPath

IMAPISession::Logoff

MAPILogonEx

IAddrBook : IMAPIProp

Concepts

MFCMAPI as a Code Sample