简体   繁体   English

无法按收到日期的顺序从 outlook 中的某个文件夹中获取邮件

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

python 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()

not getting the mails in the order of their received date未按收到日期的顺序收到邮件

output: 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

why the output is not in the order of their received date?为什么 output 不按收到日期的顺序排列? while the mails in the outlook are in the order of their received date.而 outlook 中的邮件按收到日期的顺序排列。

There is no order unless you explicitly call Items.Sort .除非您明确调用Items.Sort ,否则没有顺序。 Most likely you will get the items in their creation date, but it is not guaranteed.您很可能会在它们的创建日期获得这些项目,但不能保证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM