Outlook items.restrict给出错误

时间:2011-10-14 09:23:39

标签: c# asp.net outlook exchange-server

我试图通过编程方式从Outlook中获取邮件,其中收到的时间大于某个时间,如:

oItems.Restrict("[ReceivedTime] > " + receivedTime.ToString("yyyy-MM-dd HH:mm:ss"));

“receivedTime”是传递给函数的时间。但它给出了错误。知道怎么做吗?

1 个答案:

答案 0 :(得分:3)

您缺少值周围的单引号,应为

oItems.Restrict("[ReceivedTime] > '" + receivedTime.ToString("yyyy-MM-dd HH:mm:ss") + "'"); 

来源:http://msdn.microsoft.com/en-us/library/aa210275(v=office.11).aspx