我想知道如何在此代码中添加日期以保存Outlook中的附件文件和电子邮件:例如,我想保存2020年4月20日至2020年1月1日之间找到的文件。请问你有什么想法吗
outputDir = r"C:\Users\CMhalla\Desktop\attachment"
i=0
for m in messages:
if m.SenderEmailAddress == 'info@outlook.com':
body_content=m.Body
for attachment in m.Attachments:
i=i+1
attachment.SaveAsFile(os.path.join(outputDir,attachment.FileName + str(i)+'.xlsx'))
Outlook对象模型提供了
Items
类的Find/FindNext和Restrict方法来获取与您的条件相对应的项如果使用了类似的搜索条件,您还可能会发现How To: Retrieve Outlook calendar items using Find and FindNext methods文章很有用
换线
(从我的头顶上):
相关问题 更多 >
编程相关推荐