[英]How to program availability check and to create new meeting to Outlook?
我正在創建一個Java Web應用程序來管理一組學生和教師之間的會議。 所有這些人都已經使用Outlook來管理他們的電子郵件和個人日歷。
我想知道是否可以通過REST服務使用Exchange,Office365或Sharepoint Team Calendar構建我的Web應用程序的計划功能,以便檢查可用性並為學生和其中一位教師創建會議:
到目前為止,我發現的最有希望的機制是Microsoft Sharepoint Server的日歷,這些協作功能可以創建會議並檢查用戶列表的可用性。 缺點是它不支持一對一會議,而是支持整個團隊(據我所知)。
我的第二個選擇是要求小組中的每個人(該部門的學生和教師)公開他們的個人日歷,以便網絡應用程序能夠檢查學生和教師的可用性並發送會議請求。 顯而易見的問題是從這種方法中獲得的隱私/安全問題。
我的最后一個選擇(到目前為止,不太喜歡,因為它感覺就像重新發明輪子)是在Web應用程序中構建一個專有日歷,並向每個人發送iCal請求。 這種方法的明顯問題是兩個分開的日歷之間的同步。
此外,此功能必須是一個非常常見的需求,因此應該有大量的博客解釋如何利用Exchange / Sharepoint / Office365來實現它(由於我的雇主的基礎架構基於Microsoft,因此不考慮其他平台)。 然而,是否有人明白沒有人談論它或者我沒有在正確的地方搜索過。 有什么建議讓我指出正確的方向嗎?
Exchange本機顯示在EWS(Exchange Web服務)中公開的用戶日歷可用性,您的網絡管理員必須配置啟用EWS的Exchange服務器。 但是猜猜是什么... Office 365(據我所知)啟用了EWS服務,到期交換是Office 365優惠的一部分。
由於EWS是普通的Web服務,因此您應該在java中使用的任何內容中創建“服務存根”或代理,以創建映射wsdl文件的服務引用。
交換的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();
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.