简体   繁体   中英

How to program availability check and to create new meeting to Outlook?

I am creating a Java web app to manage meetings between a set of students and teachers. All of them already use Outlook to manage their email and personal calendar.

I would like to know if it's even possible to build the schedule feature of my web app using Exchange, Office365 or Sharepoint Team Calendar via REST service in order to check the availability and create a meeting for a student and one of the teachers available:

SharePoint 2013 REST service

So far, the most promising mechanism I have found is Microsoft Sharepoint Server's calendar, which collaborative features makes possible to create a meeting and check availability for a list of users. The downside is that it does not support one to one meetings but for the entire team (as far I have found).

My second option would be to require everyone in the group (students and teachers of the department) to make public their personal calendar so the web app be able to check the availability of both student and teacher and send a meeting request. The obvious problem is the privacy/security concern derived from this approach.

My last option (and by far the less favourite because it feels like re-inventing the wheel) is to build a proprietary calendar within the web app and send iCal requests to each person. The obvious problem with this approach is synchronisation between the two separated calendars.

In addition, this feature must be a pretty common need so there should be tons of blogs explaining how to take advantage of Exchange/Sharepoint/Office365 to implement it (other platforms are not considered since my employer's infrastructure is based on Microsoft). However, whether it is so obvious that nobody talks about it or I have not searched in the right place. Any advice to point me in the right direction?

Exchange natively shows user calendar availability exposed in EWS (Exchange Web Services), your network administrator must configure Exchange server enabling EWS. But guess what... Office 365 (as I know) have EWS services enabled, due exchange is part of office 365 offer.

As EWS are normal Web services you should create a "service stub" or proxy in whatever you use in java to create services references mapping wsdl files.

Exchanged EWS is my preferred solution.

Hope this helps.

This is the reference page, this link show how to use the service references from C# to make the right API calls.

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();
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM