This is a migrated thread and some comments may be shown as answers.

Incorrect times (+1) displayed in scheduler

0 Answers 67 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 27 Jun 2017, 01:34 PM

Hi, I'm struggling to get times to be consistent between the RadScheduler when retrieving data from Exchange via EWS.  I only need to work in GMT timezone.  I've set what I think are all necessary TimeZones to GMT, but when retrieving the data the appointments are shown +1 hour as compared to Outlook.  Some example code to show what is happening is below.  When adding a new appointment this seems to work OK and is consistent.  When updating however, the e.ModifiedAppointment.Start date is an hour behind what I actually choose in the RadScheduler.  Any help appreciated.

 

<telerik:RadScheduler TimeZoneID="GMT Standard Time" RenderMode="Lightweight" runat="server" ID="RadScheduler1" DayStartTime="07:00:00" Height="600px"
DayEndTime="20:00:00" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnAppointmentDelete="RadScheduler1_AppointmentDelete"
DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End" DataTimeZoneIdField="TimeZone" Skin="WebBlue"
RowHeight="28px" MinutesPerRow="30" FirstDayOfWeek="Monday" LastDayOfWeek="Friday" OverflowBehavior="Auto">
<AdvancedForm Modal="true"></AdvancedForm>
<TimelineView UserSelectable="false"></TimelineView>
<TimeSlotContextMenuSettings EnableDefault="true"></TimeSlotContextMenuSettings>
<AppointmentContextMenuSettings EnableDefault="true" ></AppointmentContextMenuSettings>
<Reminders Enabled="false"></Reminders>
</telerik:RadScheduler>

 

Public Function LoadAppointments() As List(Of RevAppointment)
Dim appointments As New List(Of RevAppointment)
Dim now = Date.Now
Dim startDate As Date = New Date(now.Year, now.Month, now.Day, 0, 0, 0)
Dim endDate As Date = startDate.AddDays(7)
Dim calendar As CalendarFolder = CalendarFolder.Bind(Me.ExService, WellKnownFolderName.Calendar, New PropertySet())
Dim cView As New CalendarView(startDate, endDate, 250)
cView.PropertySet = New PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.Id, AppointmentSchema.TimeZone, AppointmentSchema.StartTimeZone, AppointmentSchema.EndTimeZone)
Dim cAppointments As FindItemsResults(Of Microsoft.Exchange.WebServices.Data.Appointment) = calendar.FindAppointments(cView)
For Each cAppointment In cAppointments
Dim tz = TimeZoneInfo.GetSystemTimeZones().FirstOrDefault(Function(x) x.DisplayName = cAppointment.TimeZone)
Dim appointment As New RevAppointment
appointment._id = cAppointment.Id.ToString
appointment.Start = cAppointment.Start
appointment.End = cAppointment.End
appointment.Subject = cAppointment.Subject
appointment.TimeZone = tz.Id
appointments.Add(appointment)
Next
Return appointments
End Function

 

Protected Sub RadScheduler1_AppointmentUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentUpdateEventArgs)
Dim id As New ItemId(e.Appointment.ID)
Dim ps As New PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.Id, AppointmentSchema.TimeZone, AppointmentSchema.IsMeeting)
Dim updatedAppt As Appointment = Appointment.Bind(Me.ExService, id, ps)
updatedAppt.Subject = e.ModifiedAppointment.Subject
updatedAppt.Body = e.ModifiedAppointment.Description
updatedAppt.Start = e.ModifiedAppointment.Start
updatedAppt.End = e.ModifiedAppointment.End
updatedAppt.Location = ""
updatedAppt.ReminderDueBy = DateAdd(DateInterval.Minute, -15, e.ModifiedAppointment.Start)

Dim mode As SendInvitationsOrCancellationsMode
If updatedAppt.IsMeeting Then
mode = SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy
Else
mode = SendInvitationsOrCancellationsMode.SendToNone
End If
updatedAppt.Update(ConflictResolutionMode.AlwaysOverwrite, mode)
End Sub

 

No answers yet. Maybe you can help?

Tags
Scheduler
Asked by
Robert
Top achievements
Rank 1
Share this question
or