EWS托管API:获取通过DateTimeReceived搜索过滤器的电子邮件 [英] EWS Managed API: Fetch emails by search filter on DateTimeReceived

查看:2563
本文介绍了EWS托管API:获取通过DateTimeReceived搜索过滤器的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当搜寻在那些特定的时间框架后已收到(如下面的code提及)收件箱中的物品。它搜索的日期,但它也有返回指定时间戳的电子邮件。我想要的邮件只有指定的时间戳之后。

While searching for items in the inbox that have been received after a particular time frame (as mentioned in the code below). It searches for the date but it is also returning the email with the specified timestamp. I want the emails only after the specified timestamp.

SearchFilter greaterthanfilter = new SearchFilter.IsGreaterThan(ItemSchema.DateTimeReceived,
                    Convert.ToDateTime(lastUploadedEmailtimeStamp));

mailItems = inbox.FindItems(greaterthanfilter, view);

不知道是否有人已经遇到任何类似的问题?基本上我想搜索特定 MM / DD / YYYY HH后接收的物品:MM:SS

推荐答案

Exchange存储使用precision精确到毫秒的日期时间,EWS只给你日期时间一precision到第二然而Searchfilters做有日期时间的毫秒precision。所以,如果你的datetime戳你只使用有那么秒precision你需要使用像这样的地方比如你想这是7:43和8秒后收到的所有电子邮件

Exchange stores the datetimes with a precision down to the Millisecond, EWS only give you a precision on datetimes to the second however the Searchfilters do have a precision of milliseconds with Date time. So if you datetime stamps your using only have a precision of seconds then you need to use something like this eg where you wanted all email that was received after 7:43 and 8 seconds

SearchFilter sfs = new SearchFilter.IsGreaterThan(ItemSchema.DateTimeReceived, DateTime.ParseExact("2014/12/29 07:43:08.999", "yyyy/MM/dd HH:mm:ss.fff", null));
FindItemsResults<Item> femaa = service.FindItems(WellKnownFolderName.Inbox,sfs, iItemView);

如果你想看看你的邮件实际precision你需要使用MAPI编辑器,如MFCMAPI的OutlookSpy。然后,您可以看一下PT_SYSTIME值是FILETIME8个字节; 64位整数再$ P $自1601年1月1 psenting的100毫微秒间隔的数量看的 http://msdn.microsoft.com/en-us/library/ee157583(v = EXCHG.80 )的.aspx

If you want to look at the actual precision on your messages you need to use a MAPI editor like OutlookSpy of MFCMapi. You can then look at the PT_Systime value which are FileTime "8 bytes; a 64-bit integer representing the number of 100-nanosecond intervals since January 1, 1601" see http://msdn.microsoft.com/en-us/library/ee157583(v=EXCHG.80).aspx

干杯
格伦

这篇关于EWS托管API:获取通过DateTimeReceived搜索过滤器的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆