none
C# Handling Message Class IPM.Outlook.Recall RRS feed

  • Question

  • I have a console application using Outlook = Microsoft.Office.Interop.Outlook reference that iterates through mailitems in a set of shared inboxes and saves the message to a specific file path for reference in a workflow application, then moves the emails to a subfolder. The problem I am encountering is when the sender recalls a message (MessageClass = "IPM.Outlook.Recall"). The program stops because it is waiting on me to click "OK" in Outlook. How do I get my console app to programmatically execute the button "OK" click in Outlook, so the program can move on to the next email?

    I have done extensive searches for 3 days for a solution to this problem with no luck. This is in Windows 10, Outlook 2016.

    Here is my code:

    foreach (Object itm in inbox.Items)
                {
                    if (itm is Outlook.MailItem)
                    {
                        //Select Email messages from Inbox
                        Outlook.MailItem msg = (Outlook.MailItem)itm;
                        if (msg.MessageClass == "IPM.Outlook.Recall")
                        { 
                             ///Solution for handling recall?
                        }
                        else
                        {
                            //Extract fields from email  etc.....
    
    Monday, January 13, 2020 9:12 PM

Answers

  • You can call Items.Find/FindNext off Items.Restrict to skip all message with the message class of "IPM.Outlook.Recall""

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    • Marked as answer by sitara68 Friday, January 17, 2020 5:42 PM
    Friday, January 17, 2020 12:51 AM

All replies

  • Short of intercepting that dialog box creation and simulating a mouse click, there isn't much you can do if you are using the Outlook Object Model. You can switch to Extended MAPI (C++ or Delphi only) or Redemption (any language including C#) to process the messages.

    Also, do you really need to process all items in the folder?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, January 13, 2020 10:08 PM
  • It looks like I do need to process all the messages. I tried to skip over it, but when it hit the original message being recalled, it stopped.
    Thursday, January 16, 2020 6:04 PM
  • You can call Items.Find/FindNext off Items.Restrict to skip all message with the message class of "IPM.Outlook.Recall""

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    • Marked as answer by sitara68 Friday, January 17, 2020 5:42 PM
    Friday, January 17, 2020 12:51 AM
  • That worked perfectly. It skipped right over the recall. Skipping over it was fine with me, too.

    This is my updated code:

     foreach (Object itm in inbox.Items.Restrict("[MessageClass] = 'IPM.Note'"))
                        {
                            if (itm is Outlook.MailItem)
                            {
                                //Select Email messages from Inbox
                                Outlook.MailItem msg = (Outlook.MailItem)itm;

                                  .......




    • Edited by sitara68 Friday, January 17, 2020 5:43 PM
    Friday, January 17, 2020 5:41 PM