使用筛选器获取在特定日期之后修改的任务
本文关键字:之后 日期 修改 任务 筛选 获取 | 更新日期: 2023-09-27 18:35:30
你对 EWS 的 SearchFilter 有什么经验吗?我正在尝试获取比变量date
值更新last modified time
的任务。它以奇怪的方式使用此代码,我还尝试将日期更改为 UTC 时间格式。有什么建议我做错了什么吗?
//Create the extended property definition.
ExtendedPropertyDefinition taskLastUpdate = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Task, 0x3008, MapiPropertyType.SystemTime);
//Create the search filter.
SearchFilter.IsGreaterThanOrEqualTo filter = new SearchFilter.IsGreaterThanOrEqualTo(taskLastUpdate, date.ToString("s") + "Z");
//Get the tasks.
FindItemsResults<Item> tasks = _service.FindItems(WellKnownFolderName.Tasks, filter, new ItemView(100));
我不确定为什么它不适用于ExtendedPropertyDefinition
.
溶液:
SearchFilter greaterthanfilter = new SearchFilter.IsGreaterThanOrEqualTo(ItemSchema.LastModifiedTime, date );
SearchFilter filter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, greaterthanfilter);
Folder folder = Folder.Bind(_service, WellKnownFolderName.Tasks); //Or the folder you want to search in
FindItemsResults<Item> results = folder.FindItems(filter, new ItemView(1000));