Search code examples
pythonemailoutlook

Python Outlook how to handle recall email


My project works on emails in Inbox. When process get a "Recall" email it crashes. Recall email does not have subject attribute. I want to write some error handling. I cannot find method to move email to another folder or delete such email from Outlook.

Currently my Code skip such items using method GetPrevious() but the email is still in Inbox Do you have any ideas how to make 'recall' email disappear from Inbox folder?

    obj_emails = obj_inbox.Items
    obj_email = obj_emails.GetLast()

    if obj_email.MessageClass == 'IPM.Outlook.Recall':
        obj_email = obj_emails.GetPrevious()

Solution

  • The Outlook object model doesn't provide anything for handling or generating recall items. You may consider using a low-level API on which Outlook is based on - Extended MAPI. Also you may consider using thied-party components, i.e. wrappers around the low-level API such as Redemption.

    Try to play with MFCMAPI to make sure recall items can be easily handled (moved or removed).