May-29-2022, 01:04 PM
This is my first attempted script so it is of course not working.
I am trying to open outlook, find an email, and download the attachment
The first line of the tut I am looking at says I need to import path from pathlib and win32com.client.
I get an indentation Error for line 1 the pathlib path import. It is supposed to be a core python module and not need installing like pywin32 so I do not know what it wants.
I am trying to open outlook, find an email, and download the attachment
The first line of the tut I am looking at says I need to import path from pathlib and win32com.client.
I get an indentation Error for line 1 the pathlib path import. It is supposed to be a core python module and not need installing like pywin32 so I do not know what it wants.
from pathlib import path import win32com.client output_dir =path.cwd() / "outbut" output_dir.mkdir(parents=true, exist_ok=true) outlook = win32com.client.dispatch("outlook.application").getnamespace("MAPI") inbox =outlook.getfaultfolder(6) messages = inbox.items for message in messages: subject = Punch.report body = Message.body attachments = message.Attachments for attachment in attachments: attachment.SaveAsFile(Target_folder / str(Attachment))
Attached Files
main.py (Size: 494 bytes / Downloads: 174)