是否有批量“绑定”?对于 EWS(日历视图)?
我需要使用 Exchange Web 服务检索用户在一段时间内的日历条目。
我正在将 calendar.FindAppointments
API 与 CalendarView
结合使用。
当我使用此 api 时,返回的项目并未填写所有属性(例如 Body
、Categories
和 Attendees
)。因此,我必须执行以下操作:
CalendarFolder calendar = (CalendarFolder)Folder.Bind(this.Service, WellKnownFolderName.Calendar);
FindItemsResults<Appointment> findResults = calendar.FindAppointments(new CalendarView(startDate, endDate));
foreach (Appointment exAppt in findResults.Items)
{
Appointment a = Appointment.Bind(this.Service, exAppt.Id);
Models.Appointment appt = new Models.Appointment();
appt.End = a.End;
appt.Id = a.Id.ToString() ;
...
appt.Notes = a.Body;
...
}
注意循环内的第二个 .Bind
。
这确实使查询变慢(这已经非常可怕了)。
需要花费几分钟才能获得大约十几个日历条目!
我已经看过,但找不到任何可以让我批量检索“完整”项目的东西。难道还有类似的东西我没发现吗?
也许我做了一些严重错误的事情导致了这种表现?
I need to retrieve a users' calendar entries for a time period using Exchange Web Services.
I am using the calendar.FindAppointments
API with a CalendarView
.
When I use this api the items returned do not have all properties filled out (e.g. Body
, Categories
, and Attendees
). Because of this I have to do the following:
CalendarFolder calendar = (CalendarFolder)Folder.Bind(this.Service, WellKnownFolderName.Calendar);
FindItemsResults<Appointment> findResults = calendar.FindAppointments(new CalendarView(startDate, endDate));
foreach (Appointment exAppt in findResults.Items)
{
Appointment a = Appointment.Bind(this.Service, exAppt.Id);
Models.Appointment appt = new Models.Appointment();
appt.End = a.End;
appt.Id = a.Id.ToString() ;
...
appt.Notes = a.Body;
...
}
Note the 2nd .Bind
within the loop.
This REALLY makes querying slow (it's already pretty horrible).
It takes MULTIPLE MINUTES to get about a dozen calendar entries!
I've looked but I can't find anything that will let me batch retrieve "full" items. Is there something like that I haven't found?
Maybe I'm doing something horribly wrong that is causing this performance?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想通了:
this.Service.LoadPropertiesForItems(findResults, new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Id, ItemSchema.Body));
但我仍然希望有一种方法来指定
PropertySet
定义CalendarView
时,因为它可以通过减少往返次数进一步提高性能。I figured it out:
this.Service.LoadPropertiesForItems(findResults, new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Id, ItemSchema.Body));
But I still wish there were a way of specifying a
PropertySet
when defining aCalendarView
as it would improve performance even further by reducing the number of round trips.