解決了 !:) 我使用以下方法將我的郵件從收件箱中的某個位置移動到在線檔案中,并提供了以下提到的一些重要幫助:
import win32com
import os
import sys
outlook = win32com.client.Dispatch('outlook.application')
mapi = outlook.GetNamespace("MAPI")
src = mapi.GetDefaultFolder(6).Folders["tobemoved"]
target = mapi.Folders["Online Archive - XXX"].Folders['Archive']
messages = src.Items
i = range(messages.count, 1, -1)
for x in i:
print(x)
messages(x).Move(target)
`
我有一個名為“在線存檔-與“收件箱”電子郵件相同的電子郵件地址'的附加檔案夾,我目前無法找到它試圖使用此鏈接 來找出它的列舉。但沒有運氣..
因為我必須釋放一些磁盤空間,不勝感激任何幫助。PS嘗試了傳統的方法-Outlook在連接問題上苦苦掙扎,22k電子郵件被移動到存檔Outlook只是放棄了我:)隨時建議任何可以解決此問題的方法。
uj5u.com熱心網友回復:
您可以像這樣訪問 Office 365 在線存檔檔案夾:
將示例電子郵件替換為您在 Outlook 中看到的確切電子郵件地址。
import win32com.client
import win32com
app = win32com.client.gencache.EnsureDispatch("Outlook.Application")
outlook = app.GetNamespace("MAPI")
outlook_folder = outlook.Folders['Online Archive - [email protected]'].Folders['Inbox']
item_count = outlook_folder.Items.Count
print(item_count)
180923
uj5u.com熱心網友回復:
在低(擴展 MAPI)級別(僅限 C 或 Delphi),在線存檔只是另一個委托 Exchange 郵箱。將存檔郵箱與某個 Exchange 用戶擁有的另一個委托郵箱區分開來的唯一方法是讀取PR_PROFILE_ALTERNATE_STORE_TYPE存檔存盤組態檔部分中的屬性 - 檢索存盤條目 id ( PR_ENTRYID),然后在會話存盤表 () 中找到匹配的行IMAPISession::GetMsgStoresTable。對于匹配的行(使用IMAPISession::CompareEntryIDs),檢索PR_PROVIDER_UID屬性。使用它的值來呼叫IMAPISession.OpenProfileSection. PR_PROFILE_ALTERNATE_STORE_TYPE從物件中讀取屬性IProfSect并檢查其值是否為"Archive"(與商店名稱不同,未本地化)。
如果 C 或 Delphi 中的擴展 MAPI 不是一個選項,您可以
嘗試在集合中查找名稱以用戶的 SMTP 地址
Namespace.Stores開頭的匹配存盤。"Online Archive - "由于該前綴是特定于語言環境的,因此我不會在生產代碼中使用它。使用Redemption(我是它的作者) - 它公開了 RDOExchangeMailboxStore。
IsArchive財產。如果存檔存盤尚未在 Outlook 中打開,您也可以使用RDOSession。GetArchiveMailbox. 在 VB 腳本中:
set rSession = CreateObject("Redemption.RDOSession")
rSession.MAPIOBJECT = Application.Session.MAPIOBJECT
userAddress = rSession.CurrentUser.SMTPAddress
set store = GetOpenArchiveMailboxForUser(userAddress)
if not store is Nothing Then
MsgBox "Found archive store for " & userAddress
Else
MsgBox "Could not find archive store for " & userAddress
End If
function GetOpenArchiveMailboxForUser(SmtpAddress)
set GetOpenArchiveMailboxForUser = Nothing
for each store in rSession.Stores
if TypeName(store) = "RDOExchangeMailboxStore" Then
Debug.Print store.Name & " - " & store.Owner.SMTPAddress & " - " & store.IsArchive
if store.IsArchive and LCase(store.Owner.SMTPAddress) = LCase(SmtpAddress) Then
set GetOpenArchiveMailboxForUser = store
exit for
End If
End If
next
結束函式
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/480620.html
上一篇:付款前從結帳頁面更新用戶元資料
