突然得到错误的pywintypes.com_error MAPI-error-number: 80004001。发生了什么事?

问题描述 投票:0回答:1

所以我在我的Windows 10上使用Microsoft Office 365 ProPlus。

我写了一个python脚本,将我的电子邮件从一个账户复制到另一个账户并返回。

我的 python 版本是 3.7.3

pywin32版本是223

这个脚本两个月来完全正常工作。几天前,它突然停止工作。我调查了一下,得到了以下错误。

pywintypes.com_error: (-2147352567, 'Ausnahmefehler aufgetreten.', (4096, 'Microsoft Outlook', 'Ein Fehler ist aufgetreten. MAPI-Fehlernummer。80004001', None, 0, -2147467263), None)

我想在英语中应该是

pywintypes.com_error: (-2147352567, 'Exception occured.', (4096, 'Microsoft Outlook', 'An error occured. MAPI-error-code: 80004001', None, 0, -2147467263), None)

在我的脚本开始时,当我尝试执行

# imports
import win32com
import win32com.client
import datetime

Outlook = win32com.client.Dispatch("Outlook.Application")
ns = Outlook.GetNamespace("MAPI")
# connect to the shared calendar
recipient = ns.createRecipient(acc) # change to mail you want to get appointments from
resolved = recipient.Resolve()
appointments = ns.GetSharedDefaultFolder(recipient, 9).Items

我也不知道为什么 ns.GetSharedDefaultFolder(receiver, 9).Items。 无缘无故抛出这个错误。任何提示?

python outlook pywin32 outlook-restapi mapi
1个回答
0
投票

首先,添加 Logon 在访问MAPI之前,如果Outlook刚刚启动,它将登录到配置文件。如果它已经在运行,它将不会影响任何事情。然后尝试将两个邮箱都添加为委托存储(参见 Advanced 的选项卡 Exchange account properties 对话框)。) 您应该可以看到两个邮箱。

使用 Resolve 方法,然后检查一下返回的值。是否为真?

最后,我建议检查收件人的名字。

© www.soinside.com 2019 - 2024. All rights reserved.