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()
CodePudding user response:
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).
CodePudding user response:
Check the Class
property - all OOM objects expose it. For the MailItem
, it will be 43 (OlObjectClass.olMail
). For ReportItem
- 46 (OlObjectClass.olReport
)