【发布时间】:2020-06-29 16:18:02
【问题描述】:
自从我们移至 Office 半年度 Enterprise 频道,版本 1908,内部版本 11929.20838,我无法访问 body 或甚至电子邮件的发件人也不再通过 MAPI。
Python 版本: 尝试了 3.6.8 32 位、3.6.8 64 位和 3.8.2 32 位。
Pywin32 版本: 尝试了 228和 227
我想知道为什么会这样,因为它在以前版本的 Office(不是企业版)上仍然可以正常工作。
=== 代码示例 ===
import win32com.client
def checkOutlookInbox():
account = 'MyEmail@example.com'
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.Folders(account).Folders("Inbox")
messages = inbox.Items
for message in messages:
msg = message.body
sender = message.Sender
print(sender)
print(msg)
=== 输出(错误)===
文件“C:\Python36-32Bit\lib\site-packages\win32com\client\dynamic.py”,第 516 行,在 getattr 中 ret = self.oleobj.Invoke(retEntry.dispid,0,invoke_type,1) pywintypes.com_error: (-2147467259, '未指定的错误', None, None)
===
任何想法为什么会在这个特定的 Office 版本上发生这种情况?
【问题讨论】:
标签: python outlook office365 pywin32