我正在使用Microsoft Exchange Web服务(托管API)开发ASP.NET Web应用程序。我的目标是提供会议室地址列表作为输入,并使用GetUserAvailability
从Exchange服务器获取忙/闲信息,以便在给定的会议时间内向用户建议开放的会议室。我有有效的代码,但是当我尝试将DetailedSuggestionsWindow
限制为会议持续时间时,出现错误:
为
FreeBusyViewOptions.TimeWindow
指定的持续时间无效。
我知道我可以扩大时间范围-但随后我得到的数据又超出了我的需要。有人可以在特定时间(通常为30分钟-2小时)内找到建议的会议室吗?
答案 0 :(得分:0)
您可以参考以下链接:
// Create a collection of attendees.
List<AttendeeInfo> attendees = new List<AttendeeInfo>();
attendees.Add(new AttendeeInfo()
{
SmtpAddress = "mack@contoso.com",
AttendeeType = MeetingAttendeeType.Organizer
});
attendees.Add(new AttendeeInfo()
{
SmtpAddress = "sadie@contoso.com",
AttendeeType = MeetingAttendeeType.Required
});
// Specify options to request free/busy information and suggested meeting times.
AvailabilityOptions availabilityOptions = new AvailabilityOptions();
availabilityOptions.GoodSuggestionThreshold = 49;
availabilityOptions.MaximumNonWorkHoursSuggestionsPerDay = 0;
availabilityOptions.MaximumSuggestionsPerDay = 2;
// Note that 60 minutes is the default value for MeetingDuration, but setting it explicitly for demonstration purposes.
availabilityOptions.MeetingDuration = 60;
availabilityOptions.MinimumSuggestionQuality = SuggestionQuality.Good;
availabilityOptions.DetailedSuggestionsWindow = new TimeWindow(DateTime.Now.AddDays(1), DateTime.Now.AddDays(2));
availabilityOptions.RequestedFreeBusyView = FreeBusyViewType.FreeBusy;
// Return free/busy information and a set of suggested meeting times.
// This method results in a GetUserAvailabilityRequest call to EWS.
GetUserAvailabilityResults results = service.GetUserAvailability(attendees,
availabilityOptions.DetailedSuggestionsWindow,
AvailabilityData.FreeBusyAndSuggestions,
availabilityOptions);
有关更多信息,请参考此链接:
答案 1 :(得分:0)
方法仅支持至少24小时长的时间段 然后开始和结束于凌晨12:00限制结果 方法到较短的时间段,您必须在 客户。
因此,您无法通过所需的时间窗口。尝试删除与会者并查询仅房间的可用性,以获取更完整的结果集。