Opening the Inbox

Because no specially declared property holds the entry identifier of an information store Inbox, you must call a function to retrieve its entry identifier.

    To find the Inbox
  1. Open the information store that contains the Inbox. See Opening an Information Store.
  2. Find the entry identifier of the Inbox folder by calling HrMAPIFindInbox and passing a pointer to the open information store.
  3. Open the Inbox folder by calling IMsgStore::OpenEntry and passing the entry identifier of the Inbox.

The following sample code is from the SMBAGENT.C file in the \BKOFFICE\SAMPLES\EXCHANGE\SMBAGENT directory. It opens the Inbox folder in the mailbox of the SMBAGENT sample application.

// Find SMBAGENT's Inbox folder 
hr = HrMAPIFindInbox( lpStore, &cbInEntryID, &lpInEntryID);

ASSERTERROR ( lpInEntryID != NULL, "NULL lpInEntryID");

// Open SMBAGENT's Inbox folder
hr = MAPICALL(lpRootFolder)->OpenEntry( lpRootFolder,
    cbInEntryID, 
    lpInEntryID, 
    NULL, 
    MAPI_MODIFY|MAPI_DEFERRED_ERRORS, 
    &ulObjType, 
    (LPUNKNOWN FAR *) &lpInFolder);

if( ulObjType != MAPI_FOLDER)
{
    hr = HR_LOG( E_FAIL);
    goto cleanup;
}