您对EWS的SearchFilter有什么经验吗?我正在尝试使用last modified time
比变量date
的值更新的任务。它真的以奇怪的方式使用这段代码,我也尝试将日期更改为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));
答案 0 :(得分:2)
我不确定为什么它与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));