我可以提取电子邮件,浏览它们,将它们标记为已读,甚至排序。但是,当我尝试通过 ReceivedTime 进行限制时,它似乎不起作用。无论我输入什么日期/时间,我都一无所获。我知道 ReceivedTime 在我删除限制时基于排序工作是有效的。有什么建议么?
Application app = new Application();
NameSpace outlookNs = app.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.Folders folders = outlookNs.Folders[ohOptions.PSTName].Folders
Microsoft.Office.Interop.Outlook.Items items = folders["Inbox"].Items;
DateTime dt = DateTime.Now.Subtract(new TimeSpan(1,0,0));
items = items.Restrict("[ReceivedTime] > '" + dt.ToString("MM/dd/yyyy hh:mm:ss tt") + "'");
items.Sort("[ReceivedTime]", OlSortOrder.olAscending);
foreach (MailItem item in items)
{
String from = item.SenderEmailAddress;
}