• Sign in
 
  •  
  • MSDN Blogs
  • Microsoft Blog Images
  • More ...

  • Blog Home
  • About
  • Email Blog Author
  • Share this
  • RSS for posts
  • Atom
  • RSS for comments
  • CDO (24)
  • Code Snippet (43)
  • Custom Providers (17)
  • Debugging (7)
  • DevMsgTeam (300)
  • Documentation (108)
  • DST (8)
  • EWS (7)
  • Exchange (108)
  • Gotchas (97)
  • Hotfix (28)
  • MAPI (239)
  • MAPI Download (53)
  • MFCMAPI (101)
  • MSDN (59)
  • Non Dev (11)
  • OOM (17)
  • Outlook (171)
  • Outlook 2007 Auxiliary Reference (45)
  • Outlook Integration API (12)
  • Protocol Docs (20)
  • PST/OST (23)
  • Referrals (8)
  • Vista (12)
  • WrapPST (18)
Links:
  • Download MFCMAPI
  • MFCMAPI on Facebook
  • Troubleshooting Outlook Crashes
  • Office Update Center
  • Developer Messaging Team Blog
This site is provided "AS IS" with no warranties, and confers no rights. Use of included code samples are subject to the terms specified in the Terms of Use.
Archives
  • May 2013 (2)
  • April 2013 (1)
  • March 2013 (2)
  • February 2013 (2)
  • January 2013 (2)
  • December 2012 (4)
  • November 2012 (2)
  • October 2012 (2)
  • September 2012 (1)
  • August 2012 (3)
  • June 2012 (2)
  • May 2012 (1)
  • April 2012 (3)
  • March 2012 (3)
  • February 2012 (3)
  • January 2012 (1)
  • December 2011 (3)
  • November 2011 (1)
  • October 2011 (3)
  • September 2011 (1)
  • August 2011 (1)
  • July 2011 (4)
  • June 2011 (3)
  • May 2011 (3)
  • April 2011 (3)
  • March 2011 (5)
  • February 2011 (1)
  • January 2011 (2)
  • December 2010 (1)
  • November 2010 (4)
  • October 2010 (1)
  • September 2010 (3)
  • August 2010 (5)
  • July 2010 (3)
  • June 2010 (3)
  • May 2010 (1)
  • April 2010 (3)
  • March 2010 (3)
  • February 2010 (3)
  • January 2010 (2)
  • December 2009 (3)
  • November 2009 (5)
  • October 2009 (4)
  • September 2009 (5)
  • August 2009 (5)
  • July 2009 (11)
  • June 2009 (6)
  • May 2009 (5)
  • April 2009 (3)
  • March 2009 (18)
  • February 2009 (10)
  • January 2009 (3)
  • December 2008 (2)
  • November 2008 (2)
  • October 2008 (5)
  • September 2008 (4)
  • August 2008 (10)
  • July 2008 (6)
  • June 2008 (8)
  • May 2008 (2)
  • April 2008 (4)
  • March 2008 (2)
  • February 2008 (2)
  • January 2008 (5)
  • December 2007 (3)
  • November 2007 (2)
  • October 2007 (3)
  • September 2007 (1)
  • August 2007 (4)
  • July 2007 (5)
  • June 2007 (3)
  • May 2007 (4)
  • April 2007 (1)
  • March 2007 (6)
  • February 2007 (3)
  • January 2007 (2)
  • December 2006 (4)
  • November 2006 (3)
  • October 2006 (1)
  • August 2006 (1)
  • June 2006 (5)
  • May 2006 (5)
  • December 2005 (1)
  • November 2005 (4)
  • October 2005 (2)
  • September 2005 (1)
  • April 2005 (3)
  • December 2004 (2)
  • September 2004 (2)
  • August 2004 (3)
  • July 2004 (3)

MAPICDO and Long-Term Entry IDs

MSDN Blogs > SGriffin's MAPI Internals > MAPICDO and Long-Term Entry IDs

MAPICDO and Long-Term Entry IDs

Stephen Griffin - MSFT
2 Mar 2011 5:55 AM
  • Comments 3

When I wrote the other day about the 8211 version of the MAPICDO download, I mentioned there a new notification flag. Here’s more information on that flag.

The new flag is fnevLongTermEntryIDs:
#define fnevLongTermEntryIDs ((ULONG) 0x20000000)

This flag is not a new notification type and should not be used on its own. Instead, pass this flag in the uLEventMask parameter of IMsgStore::Advise to change the way fnevNewMail and the various fnevObject* notifications behave. Normally, when you get these notifications from the Exchange provider, the NEWMAIL_NOTIFICATION and OBJECT_NOTIFICATION structures contain Short-Term Entry IDs. With the addition of this flag, these will be Long-Term Entry IDs.

We added this flag to help with a common performance issue: MAPI clients which are tracking changes to messages will typically index their current view of messages by the Long-Term Entry ID. When they get a notification that an item has changed, they would call OpenEntry to open the item and from there request the Long-Term Entry ID so they can match the notification to the item in their index. They’d have to do this even if they don’t need any other properties from the message. These repeated OpenEntry calls can be expensive. By implementing the fnevLongTermEntryIDs flag, we’re giving them a way to avoid most of these calls.

Some notes:

  • This flag is only available in the MAPICDO download, version 6.5.8211 and above. It will not work in earlier versions of the download and will not work with Outlook’s MAPI. Attempting to use this flag on those versions of MAPI will give MAPI_E_UNKNOWN_FLAGS.
  • This flag will only work with the Exchange provider, emsmdb32.dll. It will not work with other providers, such as the PST provider, mspst32.dll.
  • This flag will only work with IMsgStore::Advise. Do not attempt to use it with other implementations of Advise.
  • There is a (very small) performance cost to this flag, as the conversion from Short-Term Entry ID to Long-Term Entry ID may require an RPC to the server. The performance cost is far less than an OpenEntry call though. If you can remove any OpenEntry calls by passing this flag, then do so.
  • A side effect of this flag: If one advise sink is registered with this flag and another is registered for the same events without the flag, both will get Long-Term Entry IDs.

Enjoy!

  • 3 Comments
Exchange, MAPI, Documentation, Hotfix, CDO, MAPI Download, DevMsgTeam
Comments
  • Frank Kang
    2 Mar 2011 10:11 AM

    Even if the long term Entry IDs are returned by the notification, isn't the CompareIDs method is still needed to match the notification to an item? If so, is there a benefit to this approach compared to using CompareIDs on a short term Entry ID from a notification to a list of long term Entry IDs in an index?

  • Stephen Griffin - MSFT
    2 Mar 2011 10:58 AM

    Certainly, you could do that. Some applications want to queue the notifications as they come in and defer processing until later (or even hand it off to another process). This can make using Short-Term Entry IDs difficult since they may no longer be valid when you get around to processing them.

  • Paul T
    2 Mar 2011 7:48 PM

    This is most welcome Steve! Currently we have to maintain a list of long term ids and use a table notification to process messages that are deleted. This is because with a short term id you can't open the entry to get its long term id (as its been deleted!). As we use the long term id to link entries in our system and exchange, this will be of huge benifit to us as we will no longer need to maintain this list. Or so I hope anyway.

Page 1 of 1 (3 items)
Leave a Comment
  • Please add 1 and 5 and type the answer here:
  • Post
  • © 2013 Microsoft Corporation.
  • Terms of Use
  • Trademarks
  • Privacy & Cookies
  • Report Abuse
  • 5.6.426.415