Outlook 365 (pywin32) - 无法访问电子邮件的正文



自从我们迁移到 Office 半年企业频道版本 1908 以来,内部版本 11929。20838,我无法再通过 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 行,在getattrret = self 中。奥利奥布。Invoke(retEntry.dispid,0,invoke_type,1( pywintypes.com_error: (-2147467259, 'Unspecified error', None, None(

===

任何想法为什么在这个特定的Office版本上发生这种情况?

首先,您没有使用 MAPI - 这是 Outlook 对象模型。 其次,您是否在收件箱中只有邮件项目对象,而没有报告项目 (NDR( 或会议请求/更新?

最新更新