是否有批量“绑定”?对于 EWS(日历视图)?

发布于 2024-12-19 12:34:08 字数 952 浏览 1 评论 0原文

我需要使用 Exchange Web 服务检索用户在一段时间内的日历条目。

我正在将 calendar.FindAppointments API 与 CalendarView 结合使用。

当我使用此 api 时,返回的项目并未填写所有属性(例如 BodyCategoriesAttendees)。因此,我必须执行以下操作:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何时共饮酒 2024-12-26 12:34:08

我想通了:

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 a CalendarView as it would improve performance even further by reducing the number of round trips.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文