The error is MAPI_E_INVALID_ENTRYID. You cannot pass NULL for the entry id. You need to call IMAPIsession::GetMsgStoresTables, find the message store that you need, then pass its entry id to OpenMsgStore.
how to initialize IMAPISession OpenMsgStore?
質問
I am using MAPI for tracking the incoming messages. (using C++) I have called MAPIInitialize and LAPILogonEx as follows:
HRESULT hr;
hr = MAPIInitialize(0);
IMAPISession *pSession;
hr = MAPILogonEx(0, NULL, NULL, 0, (LPMAPISESSION *)&pSession);
I want to register this for notifications as I want to track the incoming messages. So I tried to call the IMAPISession::OpenMsgStore
before calling IMsgStore::Advise
as follows:
IMsgStore *imsg = NULL;
hr = pSession->OpenMsgStore(NULL, NULL, 0, NULL, 0, &imsg);
But the above call does not work (It returns -2147221241). I am passing 0 to the Entry ID because I want to track messages in all the folders. Can someone please help me about where I am going wrong? Any help would be much appreciated. Thanks
解決
所属していません StackOverflow