IMsgSto:OpenEntry returns "MAPI_E_NOT_FOUND"

IMsgSto:OpenEntry returns "MAPI_E_NOT_FOUND"

Post by S0pVTk » Thu, 11 Aug 2005 02:41:05


Hello experts! I have a problem with my first MAPI code that I have no clue
at all.

The piece of code below works fine on "Client with outlook 2000 and
Server(Win2K) with Exchange 2000", however, it returns "MAPI_E_NOT_FOUND" on
"client(XP) has outook 2003 and server(Win2003) is Exchange 2003".

1. A mailbox pointer "m_lpMailbox" is obtained using OpenMsgStore
2. The Inbox's entry Id is obtained using
"m_lpMailbox->GetReceiveFolder(NULL, NULL, &cbEntryID, &lppEntryID, NULL)
3. Saved the entry Id by "m_sbInboxID.cb = cbEntryID; m_sbInboxID.lpb =
(LPBYTE) lppEntryID;" where m_sbInboxId is "SBinary"
4. At later time, pointer for the same mailbox is obtained assigned to
"mailBox"
5. Then attempted to open Inbox by "mailBox->OpenEntry(m_sbInboxId.cb,
(LPENTRYID) m_sbInboxID.lpb, NULL, MAPI_BEST_ACCESS, &ulngObjType, (LPUNKNOWN
*)&lpFolder);
==> The call in step 5 returns "MAPI_E_NOT_FOUND" when client(XP) has outook
2003 and server(Win2003) is Exchange 2003.
 
 
 

IMsgSto:OpenEntry returns "MAPI_E_NOT_FOUND"

Post by Stephen Gr » Thu, 11 Aug 2005 02:58:31

When you save the entry ID off into your local variable, do you then
MAPIFreebuffer the lppEntryID? Is it possible you didn't copy the contents
of the buffer out before freeing it? Check that the buffer you pass into
OpenEntry still has the same data as the buffer you got back from
GetReceiveFolder.

 
 
 

IMsgSto:OpenEntry returns "MAPI_E_NOT_FOUND"

Post by S0pVTk » Thu, 11 Aug 2005 03:15:02

Thanks for your reply,

No MAPIFreebuffer is called until the problem code line is reached.
The strange thing is that the code works fine on a client machine with
Outlook200 connecting to server with Exchange 2000. (So I assume the code is
correct in some level?)
 
 
 

IMsgSto:OpenEntry returns "MAPI_E_NOT_FOUND"

Post by Stephen Gr » Thu, 11 Aug 2005 03:19:56

The algorithm you describe is correct. Maybe you should post a more complete
code snippet.
 
 
 

IMsgSto:OpenEntry returns "MAPI_E_NOT_FOUND"

Post by Dmitry Str » Thu, 11 Aug 2005 04:06:39

I can reproduce this problem in Outlook 2003 cached mode (PST and non-cached
are fine) if I use an entry id returned by IMsgStore::GetReceiveFolderTable,
but IMsgStore::GetReceiveFolder always works fine for me. Have you tried
specifying something other than NULL for the message class?

Dmitry Streblechenko (MVP)
http://www.yqcomputer.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
 
 

IMsgSto:OpenEntry returns "MAPI_E_NOT_FOUND"

Post by kakyun » Thu, 11 Aug 2005 06:09:24

Hello Dmitry.

Thanks for your reply.
I forgot to mention. I use GetReceiveFolder to get Inbox entry ID but
for the Msg store pointer was obtained using entry ID obtained by
"m_lhSession->GetMsgStoresTable(0L, &lptblMailboxes );"

Maybe the usage of entry Id from the table obtained at the beginning of
the process is the problem?

And, what do you mean by "other than NULL for the message class?" Could
you please point the method call you are talking about?

thanks!
 
 
 

IMsgSto:OpenEntry returns "MAPI_E_NOT_FOUND"

Post by Dmitry Str » Thu, 11 Aug 2005 06:13:39

The store itself can be opened just fine, so i don't think the problem is
with GetMsgStoresTable.
As for the message class, IMsgStore::GetReceiveFolder() takes the message
class as the first argument. You can either pass NULL or specify an explicit
mesasge class (e.g. "IPM.Note").

Dmitry Streblechenko (MVP)
http://www.yqcomputer.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool