在处理C#Outlook之前按收件时间排序电子邮件 [英] Sorting Emails by Received time before processing C# Outlook
问题描述
在处理电子邮件之前,我需要对收到的电子邮件进行排序,因为我正在处理电子邮件并将数据从数据库中输入数据库。
I need to sort my emails by Received time before processing them as I am processing emails and entering data from it into a database.
我需要它,以便最新的要收到的电子邮件将被放入数据库以覆盖旧版本(如果有较旧版本)。
I need it so the newest email to be received gets put into the database to overwrite the older version (If there is an older version).
Microsoft.Office.Interop.Outlook.Items item =( Outlook.Items)source.Items;
Microsoft.Office.Interop.Outlook.Items item = (Outlook.Items)source.Items;
源是具有我想要的电子邮件的文件夹
Source is the folder with the emails in it that I wanted sorted
我已经尝试过这四种方式:
I have tried these four ways:
items.Sort("ReceivedTime", false);
items.Sort("[ReceivedTime]", Outlook.OlSortOrder.olAscending);
items.Sort("ReceivedTime", Outlook.OlSortOrder.olSortNone);
items.Sort("[ReceivedTime]");
哪个似乎不排序,因为它仍然将最旧的数据放入数据库中,覆盖最新
Which does not seem to sort it as It still puts the oldest into the database second, overwriting the newest submission.
任何想法?
推荐答案
应该是
it should be
items.Sort("[ReceivedTime]", false);
或 true
如果您希望他们降序
这篇关于在处理C#Outlook之前按收件时间排序电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!