Hi,
Here is how, I am creating appointment and setting its recurrence:
appointment.Key = node.SelectSingleNode("ListURL").InnerText;
#region Create Appointment's Recurrence
// check any condition
appointment.CreateRecurrence();
recurrenceObject.Period = RecurrencePeriod.Weekly;
recurrenceObject.PeriodMultiple = 2;
}
#endregion
appointment.StartDateTime = this.StringToDate(node.SelectSingleNode("StartDate").InnerText);
appointment.EndDateTime = this.StringToDate(node.SelectSingleNode("_EndDate").InnerText);
// Add the Appointment to the Activities list in the context
((IList)context.Activities).Add(appointment);
I am also having same problem. Can anybody help us please?
I didn't see anything in the original post about implementing the FetchRecurrences method. Similar to FetchActivities, the Fetch method is fired when recurrences are needed too - passing a FetchRecurrencesContext and a "FetchRecurrences" operation. In my solution I populate the recurrences for the given context (Start Date, End Date, Resource), and then I call base.OnInitializeRecurrence on each recurrence object. This is something I pulled out of the IG implementation.
Other than that, the only other thing I'd confirm is that your recurrences are being created properly. If the recurrence data isn't set up properly you won't be able to fetch them properly.
Can you please post your sample?
the only way I found to solve this problem was to add the recurring activities through a bucle as follows:
Try _dt = obtenerDatos() If Not (_dt Is Nothing) Then For i As Integer = 0 To _dt.Rows.Count - 1 Dim appointment As Appointment = New Appointment(Me.WebScheduleInfo) appointment.Key = _dt.Rows(i)("unico") _fechaInicio = Convert.ToDateTime(Convert.ToDateTime(_dt.Rows(i)("FechaInicial")).ToShortDateString().ToString() + " " + _dt.Rows(i)("HoraInicial")) _fechaFinal = Convert.ToDateTime(Convert.ToDateTime(_dt.Rows(i)("FechaInicial")).ToShortDateString().ToString() + " " + _dt.Rows(i)("HoraFinal")) appointment.StartDateTime = StringToDate(_fechaInicio.ToString()) appointment.EndDateTime = StringToDate(_fechaFinal.ToString())
appointment.Subject = _dt.Rows(i)("Titulo") appointmentReccur.Description = _dt.Rows(i)("Descripcion") appointment.Style.BackgroundImage = "../Images/ImageRecurring.png" _fechaFinalRecurrencia = Convert.ToDateTime(_dt.Rows(i)("FechaFinal")).ToShortDateString().ToString()
If (_dt.Rows(i)("Recurrente") = "S") And (DateDiff(DateInterval.Day, _fechaInicio, _fechaFinalRecurrencia) > 0) Then Dim _fechaSiguienteRecurencia As DateTime Dim _a As Integer = 1 _fechaSiguienteRecurencia = _fechaInicio.AddDays(7).ToShortDateString() While (_fechaSiguienteRecurencia <= _fechaFinalRecurrencia) Dim appointmentReccur As Appointment = New Appointment(Me.WebScheduleInfo) appointmentReccur.Key = _dt.Rows(i)("unico") + "." + _a.ToString() appointmentReccur.StartDateTime = StringToDate(_fechaSiguienteRecurencia.ToShortDateString.ToString() + " " + _dt.Rows(i)("HoraInicial")) appointmentReccur.EndDateTime = StringToDate(_fechaSiguienteRecurencia.ToShortDateString.ToString() + " " + _dt.Rows(i)("HoraFinal")) appointmentReccur.Subject = _dt.Rows(i)("Titulo") appointmentReccur.Description = _dt.Rows(i)("Descripcion") _fechaSiguienteRecurencia = _fechaSiguienteRecurencia.AddDays(7) _a = _a + 1 CType(context.Activities, IList).Add(appointmentReccur) End While End If CType(context.Activities, IList).Add(appointment) Next Else msgbox("No existe registros en la agenda.") End If Catch ex As Exception msgbox(ex.ToString()) End Try
I can't post the code - it's owned by the company I work for. If there are certain aspects you want to see I may be able to make those chunks generic enough to post.
I think a better solution would be for you to download the IG code if you have that ability with your license. Then you can look at a full implementation of the IDataFetch and IDataUpdate interfaces, from the company who built them.