繁体   English   中英

Python win32com.client和outlook

[英]Python win32com.client and outlook

我正在尝试迭代我的电子邮箱并找到一个包含特定主题的电子邮件。 我在用:

import win32com.client

outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")

inbox = outlook.GetDefaultFolder(6) # "6" refers to the index of a folder - in this case,
                                    # the inbox. You can change that number to reference
                                    # any other folder
messages = inbox.Items
message = messages.GetLast()
print(message)
body_content = message.body
print body_content

有谁知道我在哪里可以找到这方面的文件。 我想使用GetAll()函数然后按主题或getSubject()函数进行过滤,但我根本找不到这方面的文档。 任何帮助都会很棒。

我发现谷歌搜索“microsoft interop”会很快引导我到正确的页面集。 在你的情况下,我做了“microsoft interop outlook getdefaultfolder”,这导致我进入MSDN的NameSpaceClass.GetDefaultFolder方法页面,它导致我(点击几下)到Items Members页面。

我对所有MS Office应用程序使用相同的搜索技术。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM