我正在创建一个Java Web应用程序来管理一组学生和教师之间的会议。所有这些人都已经使用Outlook来管理他们的电子邮件和个人日历。
我想知道是否可以通过REST服务使用Exchange,Office365或Sharepoint团队日历构建我的Web应用程序的计划功能,以便检查可用性并为学生和其中一位教师创建会议可用的:
到目前为止,我发现的最有希望的机制是Microsoft Sharepoint Server的日历,这些协作功能可以创建会议并检查用户列表的可用性。缺点是它不支持一对一会议,而是支持整个团队(据我所知)。
我的第二个选择是要求小组中的每个人(该部门的学生和教师)公开他们的个人日历,以便网络应用程序能够检查学生和教师的可用性并发送会议请求。显而易见的问题是从这种方法中获得的隐私/安全问题。
我的最后一个选项(到目前为止,不太受欢迎,因为它感觉就像重新发明轮子一样)是在网络应用程序中构建一个专有日历,并向每个人发送iCal请求。这种方法的明显问题是两个分开的日历之间的同步。
此外,此功能必须是非常常见的需求,因此应该有大量博客解释如何利用Exchange / Sharepoint / Office365来实现它(由于我的雇主的基础架构基于Microsoft,因此不考虑其他平台) 。然而,是否有人明白没有人谈论它或者我没有在正确的地方搜索过。有什么建议让我指出正确的方向吗?
答案 0 :(得分:2)
Exchange本机显示在EWS(Exchange Web服务)中公开的用户日历可用性,您的网络管理员必须配置启用EWS的Exchange服务器。 但是猜猜是什么... Office 365(据我所知)启用了EWS服务,到期交换是Office 365优惠的一部分。
由于EWS是普通的Web服务,您应该在java中使用的任何内容中创建“服务存根”或代理,以创建映射wsdl文件的服务引用。
Exchanged EWS是我首选的解决方案。
希望这有帮助。
这是参考页面,此链接显示如何使用C#中的服务引用来进行正确的API调用。
http://msdn.microsoft.com/en-us/library/exchange/aa494212(v=exchg.140).aspx
static void GetUserAvailability(ExchangeServiceBinding esb)
{
// Identify the time to compare free/busy information.
Duration duration = new Duration();
duration.StartTime = DateTime.Now;
duration.EndTime = DateTime.Now.AddHours(4);
// Identify the options for comparing free/busy information.
FreeBusyViewOptionsType fbViewOptions = new FreeBusyViewOptionsType();
fbViewOptions.TimeWindow = duration;
fbViewOptions.RequestedView = FreeBusyViewType.MergedOnly;
fbViewOptions.RequestedViewSpecified = true;
fbViewOptions.MergedFreeBusyIntervalInMinutes = 35;
fbViewOptions.MergedFreeBusyIntervalInMinutesSpecified = true;
MailboxData[] mailboxes = new MailboxData[1];
mailboxes[0] = new MailboxData();
// Identify the user mailbox to review for free/busy data.
EmailAddress emailAddress = new EmailAddress();
emailAddress.Address = "tplate@contoso.com";
emailAddress.Name = String.Empty;
mailboxes[0].Email = emailAddress;
mailboxes[0].ExcludeConflicts = false;
// Make the request.
GetUserAvailabilityRequestType request = new GetUserAvailabilityRequestType();
// Set the time zone of the request.
request.TimeZone = new SerializableTimeZone();
request.TimeZone.Bias = 480;
request.TimeZone.StandardTime = new SerializableTimeZoneTime();
request.TimeZone.StandardTime.Bias = 0;
request.TimeZone.StandardTime.DayOfWeek = DayOfWeekType.Sunday.ToString();
request.TimeZone.StandardTime.DayOrder = 1;
request.TimeZone.StandardTime.Month = 11;
request.TimeZone.StandardTime.Time = "02:00:00";
request.TimeZone.DaylightTime = new SerializableTimeZoneTime();
request.TimeZone.DaylightTime.Bias = -60;
request.TimeZone.DaylightTime.DayOfWeek = DayOfWeekType.Sunday.ToString();
request.TimeZone.DaylightTime.DayOrder = 2;
request.TimeZone.DaylightTime.Month = 3;
request.TimeZone.DaylightTime.Time = "02:00:00";
// Add the mailboxes to the request.
request.MailboxDataArray = mailboxes;
// Add the view options to the request.
request.FreeBusyViewOptions = fbViewOptions;
try
{
// Send the request and get the response.
GetUserAvailabilityResponseType response = esb.GetUserAvailability(request);
// Access free/busy information.
if (response.FreeBusyResponseArray.Length < 1)
{
throw new Exception("No free/busy response data available.");
}
else
{
foreach (FreeBusyResponseType fbrt in response.FreeBusyResponseArray)
{
if (fbrt.ResponseMessage.ResponseClass == ResponseClassType.Error)
{
Console.WriteLine(string.Format("Error: {0}", fbrt.ResponseMessage.MessageText));
}
else
{
// Show the free/busy stream.
FreeBusyView fbv = fbrt.FreeBusyView;
Console.WriteLine(string.Format("Merged free/busy data: {0}", fbv.MergedFreeBusy));
}
}
}
}
catch (Exception e)
{
// Perform error processing.
Console.WriteLine(e.Message);
Console.ReadLine();
}
}