private void sayAppointment_TurnStarting(object sender, TurnStartingEventArgs e) { //Read First Calendar Event, We could use the navigablelist here to read all //but for now we will just read the first one CalendarObject calendarEvent = _calendarList[0]; this.sayAppointment.MainPrompt.ClearContent(); this.sayAppointment.MainPrompt.AppendText("The selected appointment, {0}, starts on ", calendarEvent.Subject); this.sayAppointment.MainPrompt.AppendTextWithHint(calendarEvent.StartDate.ToLongDateString(), Microsoft.SpeechServer.Synthesis.SayAs.Date); this.sayAppointment.MainPrompt.AppendText(" at "); this.sayAppointment.MainPrompt.AppendBreak(Microsoft.SpeechServer.Synthesis.PromptBreak.Small); this.sayAppointment.MainPrompt.AppendTextWithHint(calendarEvent.StartDate.ToShortTimeString(), Microsoft.SpeechServer.Synthesis.SayAs.Time); this.sayAppointment.MainPrompt.AppendText(" and ending at "); this.sayAppointment.MainPrompt.AppendTextWithHint(calendarEvent.EndDate.ToShortTimeString(), Microsoft.SpeechServer.Synthesis.SayAs.Time); this.sayAppointment.MainPrompt.AppendBreak(Microsoft.SpeechServer.Synthesis.PromptBreak.Small); this.sayAppointment.MainPrompt.AppendText(" and it is located in "); this.sayAppointment.MainPrompt.AppendText(calendarEvent.Location); this.sayAppointment.MainPrompt.AppendBreak(Microsoft.SpeechServer.Synthesis.PromptBreak.Small); }
public static List <CalendarObject> GetCalendarData(DateTime lookupDate) { List <CalendarObject> calendarObjects = new List <CalendarObject>(); //umdemo.dnsalias.com explicit credentials ExchangeServiceBinding exchangeServer = new ExchangeServiceBinding(); ICredentials creds = new NetworkCredential(user, password, "um.test.com"); exchangeServer.Credentials = creds; exchangeServer.Url = @"http://um.test.com/ews/exchange.asmx"; GetUserAvailabilityRequestType request = new GetUserAvailabilityRequestType(); MailboxData[] mailboxes = new MailboxData[1]; mailboxes[0] = new MailboxData(); // Identify the user mailbox to review their Free/Busy data EmailAddress emailAddress = new EmailAddress(); emailAddress.Address = "*****@*****.**"; emailAddress.Name = String.Empty; mailboxes[0].Email = emailAddress; request.MailboxDataArray = mailboxes; //Set TimeZone 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"; // Identify the time to compare if the user is Free/Busy Duration duration = new Duration(); duration.StartTime = lookupDate; duration.EndTime = lookupDate.AddDays(1); // Identify the options for comparing F/B FreeBusyViewOptionsType viewOptions = new FreeBusyViewOptionsType(); viewOptions.TimeWindow = duration; viewOptions.RequestedView = FreeBusyViewType.Detailed; viewOptions.RequestedViewSpecified = true; request.FreeBusyViewOptions = viewOptions; GetUserAvailabilityResponseType response = exchangeServer.GetUserAvailability(request); foreach (FreeBusyResponseType responseType in response.FreeBusyResponseArray) { if (responseType.FreeBusyView.CalendarEventArray.Length > 0) { foreach (CalendarEvent calendar in responseType.FreeBusyView.CalendarEventArray) { CalendarObject calendarObject = new CalendarObject(); calendarObject.Location = calendar.CalendarEventDetails.Location; calendarObject.Subject = calendar.CalendarEventDetails.Subject; calendarObject.StartDate = calendar.StartTime; calendarObject.EndDate = calendar.EndTime; calendarObject.IsMeeting = calendar.CalendarEventDetails.IsMeeting; calendarObjects.Add(calendarObject); } } } return(calendarObjects); }