'"Send file by email" from Acrobat Reader does NOT invokes Items.ItemAdd() event for "Sent Items" folder?

I have a VSTO addin with Outlook. I currently use the "Sent Items" Folder in my Items.ItemAdd() event to intercept the email to process and save it into a depository. Everything works Ok if I create new email and send from my Outlook, BUT if I open a local PDF document in Acrobat Reader and click on "Send file by email" toolbar button, use Outlook as default, it opens a new email, fill up the email address (to myself), the Items.ItemAdd() event is never called? I do see the email arrives in my "Sent Items" folder.

There is class MailItem which handle new email and has a Event_Send such as

if ((m_MailItem is Outlook.MailItem) ((Outlook.ItemEvents_10_Event)m_MailItem).Send += new Outlook.ItemEvents_10_SendEventHandler(Event_Send);

When user clicks on Send button on the new email, the event Event_Send() is called which will call SubscribeSentFolder() in Addin class

void Event_Send() {
AddIn.SubscribeSentFolder(m_MailItem)) }

These methods are in Addin class private static Outlook.MAPIFolder m_sentFlder=null; private static Outlook.Items sentitems=null;

public static bool SubscribeSentFolder(object Item) 
{ 
  m_sentFlder=((Outlook.MailItem)Item).SaveSentMessageFolder; 
  if (m_sentFlder != null) 
  { 
    sentitems=m_sentFlder.Items; 
    sentitems.ItemAdd += Items_ItemAdd; 
    return true; 
   } 
 } 

private static void Items_ItemAdd(object item) 
{ 
  object mapiOb=null; 
  if (item is Outlook.MailItem) 
  { 
    mapiOb=((Outlook.MailItem)Item).MAPIOBJECT; 
    if (mapiOb !=null) 
        Process(mapiOb); //Inside this Process method 
                         UnSubscribeSentFolder() will be called.
  } 
}


Solution 1:[1]

Outlook may not wait until your mail is sent out actually when you sent items that way. It seems the mail item was put to the Sent Items folder after Outlook was closed or before your add-in subscribes to the event at the next startup.

A possible solution is to mark items put into the repository (it can be a user property or any other moniker) and scan the folder at each start for any unprocessed items. If you find any do the process for them.

For users with an Exchange Server account (non-Cached Exchange Mode or Cached Exchange Mode), the event will fire only for messages that are sent at the server after Outlook has started. The event will not fire for messages that are synchronized in Cached Exchange Mode immediately after Outlook starts, nor for messages that are already on the server when Outlook starts in non-Cached Exchange Mode.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1