Using w32 python library, I am taking an email and saving the attachment from Outlook. I have seen several questions dealing with this topic with the most promising being here: Marking an email as read python
I have tried a few variations of the above answer but have been unable to get a working demo
# new outlook object
outlook = win32.Dispatch("Outlook.Application")
# get user namespace
namespace = outlook.GetNamespace("MAPI")
# The default folder changes every time we boot up outlook
# This loop finds the correct inbox
for x in range(4):
print(x)
try:
print(namespace.Folders.Item(x).name)
if namespace.Folders.Item(x).name == '[email protected]':
root_folder = namespace.Folders.Item(x)
break
except:
pass
# Mark the item as read in the folder
for msg in root_folder.Folders['Inbox'].Folders('temp').Items:
msg.is_read = True
msg.save(updated_fields=['is_read'])
When I run the piece of code below I get the error
AttributeError: Property '.is_read' can not be set.
Can anyone make any suggestions on how i might go about fixing this?
AttributeError: Property '.is_read' can not be set.
The Outlook object model provides the UnRead property instead.