簡體   English   中英

無法按收到日期的順序從 outlook 中的某個文件夾中獲取郵件

[英]Not able to get mails from a certain folder in outlook in the order of their received date

python

outlook=win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
folder=outlook.Folders.Item("required folder")
mails=folder.Items
mail=mails.GetLast()
while(mail):
   print(mail.SentOn)
   mail=mails.GetPrevious()

未按收到日期的順序收到郵件

output:

2019-10-27 07:54:44+00:00
2019-10-27 07:55:46+00:00
2019-10-25 14:17:07+00:00
2019-10-23 10:06:08+00:00
2019-10-24 09:33:07+00:00
2019-10-25 02:59:24+00:00

為什么 output 不按收到日期的順序排列? 而 outlook 中的郵件按收到日期的順序排列。

除非您明確調用Items.Sort ,否則沒有順序。 您很可能會在它們的創建日期獲得這些項目,但不能保證。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM