Updating recurrences in tasks, creates a new task instead of replacing the old one. RRS feed

  • General discussion

  • Hi, I'm trying to update/create a recurring task using EWS whose parent task has already been created earlier. But while doing so, a new task with the recurrence (having the same name as the parent task) is being created in outlook instead of editing the existing one.

    The following is the code snippet used : 

      if (reccType == RecurrenceType.Daily && recurrenceInfo.WeekDays != WeekDays.WorkDays)
                                    exchangeTask.Recurrence = new Recurrence.DailyPattern();
                                else if (reccType == RecurrenceType.Weekly || (reccType == RecurrenceType.Daily && recurrenceInfo.WeekDays == WeekDays.WorkDays))
                                    exchangeTask.Recurrence = new Recurrence.WeeklyPattern(recurrenceInfo.Start, recurrenceInfo.Periodicity, GetWeekDays(recurrenceInfo.WeekDays));
                                else if (reccType == RecurrenceType.Monthly)
                                    if (recurrenceInfo.WeekOfMonth == WeekOfMonth.None)
                                        exchangeTask.Recurrence = new Recurrence.MonthlyPattern(recurrenceInfo.Start, recurrenceInfo.Periodicity, recurrenceInfo.DayNumber);
                                        exchangeTask.Recurrence = new Recurrence.RelativeMonthlyPattern(recurrenceInfo.Start, recurrenceInfo.Periodicity, GetWeekDays(recurrenceInfo.WeekDays, true), GetWeekOfMonth(recurrenceInfo.WeekOfMonth));
                                else if (reccType == RecurrenceType.Yearly)
                                    if (recurrenceInfo.WeekOfMonth == WeekOfMonth.None)
                                        exchangeTask.Recurrence = new Recurrence.YearlyPattern(recurrenceInfo.Start, GetMonth(recurrenceInfo.Month), recurrenceInfo.DayNumber);
                                        exchangeTask.Recurrence = new Recurrence.RelativeYearlyPattern(recurrenceInfo.Start, GetMonth(recurrenceInfo.Month), GetWeekDays(recurrenceInfo.WeekDays, true), GetWeekOfMonth(recurrenceInfo.WeekOfMonth));
                                // range
                                if (taskViewModel.TasksReminderRecurrenceDetails.TaskRecurrenceStartDate.HasValue)
                                    exchangeTask.Recurrence.StartDate = Convert.ToDateTime(taskViewModel.TasksReminderRecurrenceDetails.TaskRecurrenceStartDate.Value);
                                if (recurrenceInfo.Range == RecurrenceRange.EndByDate)
                                    exchangeTask.Recurrence.EndDate = taskViewModel.TasksReminderRecurrenceDetails.TaskRecurrenceEndDate;
                                else if (recurrenceInfo.Range == RecurrenceRange.OccurrenceCount)
                                    exchangeTask.Recurrence.NumberOfOccurrences = taskViewModel.TasksReminderRecurrenceDetails.TaskRecurrenceNoOfOccurrence;

    As you can see in the above code, I'm calling the 'exchangeTask.Update(ConflictResolutionMode.AlwaysOverwrite)' function which I believe is used to update and overwrite the existing task. The above is just a portion of the code. I'm using the same exchange ID, each time while updating a task. The duplication occurs only while adding/updating recurrences to an existing task. Such an issue does not occur if I update the task without any recurrences. Am I doing it wrong? Should I add or change anything? Kindly let me know at the earliest. Your time and cooperation would be highly appreciated :)

    • Changed type AnonymousEws Wednesday, November 27, 2019 7:35 AM
    Friday, November 15, 2019 2:21 PM

All replies