I'm writing an Outlook Addin using VC/ATL. This particular addin takes selected email messages and writes them to disk. It also writes all of the associated attachments to disk. We then read everything in to our application outside of Outlook.
Using the Outlook object model, this is pretty straightforward as both _MailItem and Attachment have SaveAs methods. The problem comes when an attachment is an embedded email itself, which we also want to break apart and save as individual files.
In an ideal world, I could query the attachment for the _MailItem interface and just handle it like a normal part of the selection. But QueryInterface returns "no interface".
I need a solution that works with Outlook XP (2002) through Outlook 2010. I know that in Outlook 2007 there is a method (CreateItemFromTemplate) on the application object which allows me to get a MailItem back from a saved message on disk, but that won't work for Outlook XP / 2003. I also need sender / recipient info intact.
I also know that the 3rd party Redemption library can do this using Extended MAPI. However, we are trying to avoid using 3rd party libraries.