We have some trouble with WinSchedule in Version 8.3.20083.2138 (I know, old version, but our customer is still using this one). When saving an UltraWinSchedule.AppointmentRecurrence object to a byte array all variances are lost. Example in VB.NET:
Dim count1 = myRecurrence.Variances.CountDim b As Byte() = myRecurrence.Save()Dim r2 As AppointmentRecurrence = AppointmentRecurrence.FromBytes(b)Dim count2 = r2.Variances.Count
Hello Neils,
Could you please provide a sample project in your next post reproducing the mentioned behavior since I was not able to do so when I tried.
Hello, Boris!
Just take the example code out of the online help for recurrence:
' To programatically create a recurring appointment,' you need to create an appointment object and assign' an 'AppointmentRecurrence' that provides the recurrence' information. Note, an AppointmentRecurrence instance can' only be associated with one appointment.
Dim dt As DateTime = DateTime.Now Dim rootAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, "New Recurring Appointment") ' create a recurrence that will occur every day for 30 days rootAppt.Recurrence = New AppointmentRecurrence() rootAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily rootAppt.Recurrence.PatternInterval = 1 rootAppt.Recurrence.RangeLimit = RecurrenceRangeLimit.LimitByNumberOfOccurrences rootAppt.Recurrence.RangeMaxOccurrences = 30 ' now let's get an occurence of this appointment ' we'll start by getting the appointments that occur ' tomorrow Dim appts As AppointmentsSubsetCollection = Me.ultraCalendarInfo1.GetDay(dt.AddDays(1D), True).Appointments ' now get the appointment that represents an occurrence of ' the above appt Dim occurrence As Appointment = appts(0) ' By changing values such as the StartDateTime, AllDayEvent, ' Locked, Visible, etc. of an occurrence of a recurring ' appointment, a variance is created. occurrence.AllDayEvent = True
After that put this code:
Dim count1 = rootAppt.Recurrence.Variances.Count Dim b as Byte() = rootAppt.Recurrence.Save() Dim r2 As AppointmentRecurrence = AppointmentRecurrence.FromBytes(b) Dim count2 = r2.Variances.Count
As a result, count1 is 1, count2 is 0
P. S.: same happens if you do a .Save() on the appointment object itself - no more variances although the recurrence object is correctly set.