Exercise 1: Working with the Exchange Free-Busy Service

Task 1 – Beginning the Exercise

In this task, you will open the project and configure it to run with your accounts.

  1. Navigate to Start >> All Programs >> Microsoft Visual Studio 2010.
  2. Click on the Microsoft Visual Studio 2010 icon to start Visual Studio 2010.
  3. Select File >> Open Project.
  4. Navigate to the folder C:\%Office365TrainingKit%\Labs\10.3\Source\Before\ EWSMA_FreeBusy.sln.
  5. Open the EWSMA_FreeBusy project.
  6. In Solution Explorer, open the app.config file.
  7. Change the PrimaryLabUserId and SecondaryLabUserId values to your primary and secondary lab accounts.
  8. Open Outlook 2010 and create three appointments in the primary lab user’s Calendar throughout the day.
  9. Start a remote desktop session as the secondary lab user.
  10. Open Outlook 2010 and create three appointments in the secondary lab user’s Calendar throughout the day. Make sure one of them overlaps with one of the primary lab user’s appointments.

Task 2 – Querying the Free-Busy Service

In this task, you will query the free-busy service to find available appointment times with the secondary lab user.

  1. Navigate to TODO: 10.3.1.
  2. Add the following code after the TODO: 10.3.1 comment. This creates a list of users for whom you want to query availability information.

    C#

    List<AttendeeInfo> attendees = new List<AttendeeInfo>(); attendees.Add(new AttendeeInfo() { SmtpAddress = _primaryLabUserId, AttendeeType = MeetingAttendeeType.Organizer }); attendees.Add(new AttendeeInfo() { SmtpAddress = _secondaryLabUserId, AttendeeType = MeetingAttendeeType.Required });

  3. Navigate to TODO: 10.3.2.
  4. Add the following code after the TODO: 10.3.2 comment. This defines the requirements for the call to the free-busy service.

    C#

    AvailabilityOptions options = new AvailabilityOptions(); options.MeetingDuration = 60; options.MaximumNonWorkHoursSuggestionsPerDay = 4; options.MinimumSuggestionQuality = SuggestionQuality.Good; options.RequestedFreeBusyView = FreeBusyViewType.FreeBusy; GetUserAvailabilityResults results = _service.GetUserAvailability( attendees, new TimeWindow(DateTime.Now, DateTime.Now.AddDays(1)), AvailabilityData.FreeBusyAndSuggestions, options);

  5. Un-comment code surrounded by /* … */ block to display the results of the free-busy service query.
  6. Go to Debug >> Start Without Debugging or [Ctrl]+[F5] to start the application.
  7. The console will display a list of suggested appointment times and their quality.
  8. Open the primary lab user’s calendar in Outlook 2010 and verify that the time slots during the suggested meeting times do not conflict with any appointments.

  9. Open the secondary lab user’s calendar in Outlook 2010 and verify that the time slots during the suggested meeting times do not conflict with any appointments.
  10. Choose one of the suggested meeting times.
  11. Open your Outlook calendar to verify that the appointment was scheduled.

  12. Close the console application.
Note:
TimeWindow must span into the next day or the GetUserAvailability call will throw an exception.