May-17-2021, 08:53 AM
Good morning,
I have created the following script, which downloads unread email attachments from my outlook account. How do I then mark them as read once its downloaded?
Thank you
I have created the following script, which downloads unread email attachments from my outlook account. How do I then mark them as read once its downloaded?
Thank you
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import win32com.client import datetime import os import email outlook = win32com.client.Dispatch( "Outlook.Application" ).GetNamespace( "MAPI" ) inbox = outlook.GetDefaultFolder( 6 ).Folders.Item( "LGW Performance" ) message = inbox.items for message in inbox.Items: if message.Unread = = True : for attachment in message.Attachments: print (attachment.FileName) #attachment.SaveAsFile("C:\\Users\\shanen\\Desktop\\Python\\"+ attachment.FileName) |