获取客房约会有效地交流 [英] Getting Room Appointments Efficiently from Exchange
问题描述
问题
我需要能够从满足使用Exchange客房获取预约数据托管API。我已经运行了一个月左右可以完成该任务就好了通过使用服务 ExchangeService.GetUserAvailability()
如下:
I need to be able to get appointment data from meeting rooms using the Exchange Managed API. I have had a service running for about a month that serves this purpose just fine by using ExchangeService.GetUserAvailability()
as follows:
private IEnumerable<CalendarEvent> GetEvents(ExchangeService ExchangeService, string room, DateTime time, DateTime end)
{
List<AttendeeInfo> attendees = new List<AttendeeInfo>();
end = new DateTime(time.Ticks + Math.Max(end.Ticks - time.Ticks, time.AddDays(1).Ticks - time.Ticks));
AttendeeInfo roomAttendee = new AttendeeInfo();
roomAttendee.AttendeeType = MeetingAttendeeType.Room;
roomAttendee.SmtpAddress = GetEmailAddress(room);
attendees.Add(roomAttendee);
Collection<CalendarEvent> events = ExchangeService.GetUserAvailability(
attendees,
new TimeWindow(time, end),
AvailabilityData.FreeBusy
).AttendeesAvailability[0].CalendarEvents;
return (from e in events
where e.EndTime > time
select e);
}
不过,我最近不得不延长该服务来执行那些需要较大的时间(去从一天到几个月)跨度一些其他任务。这种方法就与增加的时间非常低效,而且偶尔会引发错误的时候有太多的结果。
However, I have recently had to extend this service to perform some other tasks that have required larger spans of time (gone from one day to several months). This method becomes highly inefficient with an increase in time, and can occasionally throw errors when there are too many results.
问题
这是要对这个最有效的方法是什么?我发现没有更好的办法,但我会很感激的确认。
Is this the most efficient way of going about this? I have found no better ways, but I would be grateful for confirmation.
推荐答案
您可以尝试使用的 ExchangeService.FindItems 这使您可以:
You can try using ExchangeService.FindItems which enables you to :
- 使用分页来获取巨大的结果集。
- 选择字段,你想从服务器 来获得
-
指定SearchFilter,可以过滤此查询服务器端:
- use pagination to fetch huge resultsets.
- select the fields you want to get from the server
specify a SearchFilter that could filter this query server side :
从E在事件 其中,e.EndTime>时间 选择e
from e in events where e.EndTime > time select e
这篇关于获取客房约会有效地交流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!