EWS FindItems无法正常工作 [英] EWS FindItems not working

查看:103
本文介绍了EWS FindItems无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我过去曾在压光机上放置物品,但是FindItems()调用返回了0个结果.

I have place items on the calender (in the past), however the FindItems() call is coming back with 0 results.

屏幕截图显示了此会议室邮箱在预定日期安排的会议

Screenshot to show there are meetings scheduled for this Room Mailbox for the desired date

搜索代码

SearchFilter greaterthanfilter = new SearchFilter.IsGreaterThanOrEqualTo(ItemSchema.DateTimeReceived, start);
                    SearchFilter lessthanfilter = new 

SearchFilter.IsLessThan(ItemSchema.DateTimeReceived, end);
                    SearchFilter filter = new 

SearchFilter.SearchFilterCollection(LogicalOperator.And, greaterthanfilter, lessthanfilter);                

    ItemView view = new ItemView(100); //TODO: This value needs to be set based on the date range criteria

                ExtendedPropertyDefinition prop = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Appointment, 0x8238, MapiPropertyType.String);
                PropertySet psPropset = new PropertySet(BasePropertySet.FirstClassProperties) { AppointmentSchema.Subject, AppointmentSchema.Organizer, prop };
                view.PropertySet = psPropset;
                view.OrderBy.Add(ItemSchema.DateTimeReceived, Microsoft.Exchange.WebServices.Data.SortDirection.Descending);
                view.Traversal = ItemTraversal.Shallow;

                findResults = this.exchangeService.FindItems(new FolderId(WellKnownFolderName.Calendar, new Mailbox(address.Address)), filter, view);

开始和结束日期通过方法的参数输入.我已经在这里断点了,并确保日期是

The start and ends dates are fed in via the parameters of the method. I have breakpointed there and ensured the dates are

开始-1/6/2014 12 am

Start - 1/6/2014 12 am

完-2014年1月8日上午12点

End - 1/8/2014 12 am

但是findResults始终为空(计数为0).

However the findResults are always empty (count is 0).

推荐答案

如果要搜索日历项目,则使用DateTimeReceived不是正确的属性.您应该使用AppointmentSchema.Start约会上的DateTimeRecieved会在创建约会时而不是在计划开始时代表更多时间.

If you want to search for calendar Items then using the DateTimeReceived isn't the correct property to use. You should use AppointmentSchema.Start the DateTimeRecieved on the appointment would represent more when the appointment was created not when they are scheduled to start.

如果要基于日期范围枚举日历约会,则应使用FindAppointments

If you want to enumerate calendar appointments based on a date range then you should use FindAppointments http://msdn.microsoft.com/en-us/library/office/dn439786(v=exchg.80).aspx . The difference here is that the recurring appointments will be expanded as well.

欢呼 格伦

这篇关于EWS FindItems无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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