共用方式為


IAddrBook::GetDefaultDir

Applies to: Office 2010 | Outlook 2010 | Visual Studio

Returns the entry identifier for the initial address book container.

HRESULT GetDefaultDir(
  ULONG FAR * lpcbEntryID,
  LPENTRYID FAR * lppEntryID
);

Parameters

  • lpcbEntryID
    [out] A pointer to the byte count in the entry identifier pointed to by the lppEntryID parameter.

  • lppEntryID
    [out] A pointer to a pointer to the entry identifier of the default container.

Return Value

  • S_OK
    The entry identifier of the default container was successfully returned.

Remarks

Client applications and service providers call the GetDefaultDir method to retrieve the entry identifier of the default address book container. The default container is what the user sees displayed in the address book when the address book is first opened. If a default container has not been set by a call to the IAddrBook::SetDefaultDir method, MAPI assigns as the default container the first container with names that is not the personal address book (PAB). If such a container cannot be found, the PAB becomes the default container.

To set the default directory, a client or provider calls the SetDefaultDir method. Clients and providers do not have to call the IMAPIProp::SaveChanges method; because changes to the address book are not transacted, changes are immediately made permanent.

MFCMAPI Reference

For MFCMAPI sample code, see the following table.

File

Function

Comment

MainDlg.cpp

CMainDlg::OnOpenDefaultDir

MFCMAPI uses the GetDefaultDir method to get the ID for the default address book container.

See Also

Reference

IAddrBook::SetDefaultDir

MAPIAllocateBuffer

MAPIFreeBuffer

PidTagContainerFlags Canonical Property

IAddrBook : IMAPIProp

Concepts

MFCMAPI as a Code Sample