I would like to download specific attachments that are coming from my Outlook inbox. I would like to filter these emails based on the subject and the date that its being sent on.
This is what I am doing:
Outlook = win32com.client.Dispatch("Outlook.Application")
olNs = Outlook.GetNamespace("MAPI")
Inbox = olNs.GetDefaultFolder(6)
Filter = "[Subject] = 'Important Report' And [SenderEmailAddress] = 'data@cool.com' And [SentOn]
> '9/26/2020 08:00 AM'"
Items = Inbox.Items.Restrict(Filter)
Item = Items.GetFirst()
for attachment in Item.Attachments:
print(attachment.FileName)
attachment.SaveAsFile(r"C:\Users\lynnette\Desktop\file.xls")
Currently, it is being filtered using [SentOn], however, I am using a specific date. I would like to filter based on the current date. I have researched Items.Restrict and could not find a Current date filter.
Any help is appreciated