Outlook: GetItemFromID does not work if store Id is given in Partial Cached Exchange Mode

1

I am trying to retrieve item using mapiNameSpace.GetItemFromID(entryId, storeID). I am using partial cached exchange mode( i.e. cache only for a month). The method works fine for cached items. But when I try it for an item older than a month, below exception is thrown

System.Runtime.InteropServices.COMException (0x8004010F): The message you specified cannot be found.
   at Microsoft.Office.Interop.Outlook.NameSpaceClass.GetItemFromID(String EntryIDItem, Object EntryIDStore)

But if I try it with only entryID and it is working. But this will be time consuming since it will search all stores.

What could be the reason for the error while using storeID parameter in partial cached mode?

P.S. This problem is only in partial Cached Exchange Mode in outlook account settings. Not when completely ON/OFF

outlook
outlook-addin
asked on Stack Overflow Oct 20, 2016 by shrikanthbat • edited Oct 24, 2016 by Clay

1 Answer

0

If you don't specify the store entry id, Outlook does not search though all stores. Outlook calls IMAPISession::OpenEntry. If the store was already opened in the current session, it had a chance to register its own entry ids so that the MAPI system knows which store to direct the call to. Otherwise you get "an unknown entry id" error. If the store entry id is specified, it is opened first, and then the message using IMsgStore::OpenEntry.

What probably happens in your case, is that the item is opened from the online store, which is expensive since the call goes over the network.


User contributions licensed under CC BY-SA 3.0