Working With Recurring Tasks

[ Hide Show ]

Aspose.Tasks for C++ API allows developers to create recurring tasks and define recurrence patterns.

Adding New Recurring Tasks

The RecurringTaskParameters class can be used to define various parameters for a recurring task. The following code example shows how to create a weekly recurring task. Other recurrence patterns like as MonthlyRecurrencePattern, DailyRecurrencePattern, YearlyRecurrencePattern can also be used.

1// Create project instance
2auto project = System::MakeObject<Project>(dataDir + u"Blank2010.mpp");
3auto parameters = [&]{ auto tmp_0 = System::MakeObject<RecurringTaskParameters>(); tmp_0->set_TaskName(u"Recurring task"); tmp_0->set_Duration(project->GetDuration(1, Aspose::Tasks::TimeUnitType::Day)); tmp_0->set_RecurrencePattern([&]{ auto tmp_1 = System::MakeObject<WeeklyRecurrencePattern>(); tmp_1->set_Repetition([&]{ auto tmp_2 = System::MakeObject<WeeklyRepetition>(); tmp_2->set_RepetitionInterval(2); tmp_2->set_WeekDays(Aspose::Tasks::WeekdayType::Sunday | Aspose::Tasks::WeekdayType::Monday | Aspose::Tasks::WeekdayType::Friday); return tmp_2; }()); tmp_1->set_RecurrenceRange([&]{ auto tmp_3 = System::MakeObject<EndByRecurrenceRange>(); tmp_3->set_Start(System::DateTime(2018, 7, 1, 8, 0, 0)); tmp_3->set_Finish(System::DateTime(2018, 7, 20, 17, 0, 0)); return tmp_3; }()); return tmp_1; }()); return tmp_0; }();
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.