[英]Reading Outlook Emails in Shared Folder - Python
我一直在使用以下代碼訪問 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)
有沒有辦法從共享郵箱中搜索電子郵件?
謝謝
嘗試這個:
inbox = outlook.Folders("Name of Shared Folder").Folders.Item("xxxxx")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.