【发布时间】:2019-11-14 13:11:12
【问题描述】:
我一直在使用以下代码访问 Outlook 中的公用文件夹:
import win32com.client
import datetime
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(18).Folders.Item("xxxxx")
messages = inbox.Items
date = datetime.date.today()
subject = "xxxxxxx"
for message in messages:
if subject in message.subject and date in message.senton.date():
print(message.senton.time())
但是,我们的 Outlook 已从 Exchange 服务器移至云端,公用文件夹已更改为共享文件夹(我认为?)。上面的代码不再有效,我收到以下错误:
pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096, 'Microsoft Outlook', 'The attempted operation failed. An object could not be found.', None, 0, -2147221233), None)
有没有办法从共享邮箱中搜索邮件?
谢谢
【问题讨论】: