Platform SDK: MAPI |
To open a message
IMAPIFolder::OpenEntry
IMsgStore::OpenEntry
IMAPISession::OpenEntry
The fastest method is usable only for incoming messages and involves calling the receive folder's IMAPIFolder::OpenEntry method. The next fastest method, calling the message store's IMsgStore::OpenEntry method, is usable for all messages as is the slowest method, calling IMAPISession::OpenEntry.
Note Folders and their contents tables can be closed at any time without adversely affecting any of the messages that were opened from within them.
To open a message that has been saved on disk
LPSTORAGE pStorage = NULL; HRESULT hr = StgOpenStorage (L"MESSAGE.MSG", NULL, STGM_TRANSACTED | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &pStorage);
LPMESSAGE pMessage = NULL; LPMALLOC pMalloc = MAPIGetDefaultMalloc(); hr = OpenIMsgOnIStg (NULL, MAPIAllocateBuffer, MAPIAllocateMore, MAPIFreeBuffer, pMalloc, NULL, pStorage, NULL, 0, 0, &pMessage);