Working with Recurring Task
Contents
[
Hide
Show
]Aspose.Tasks for .NET let developers 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.
1Project project = new Project("New Project.mpp");
2RecurringTaskParameters parameters = new RecurringTaskParameters
3{
4 TaskName = "Recurring task",
5 Duration = project.GetDuration(1, TimeUnitType.Day),
6 RecurrencePattern =
7 new WeeklyRecurrencePattern
8 {
9 Repetition = new WeeklyRepetition
10 {
11 RepetitionInterval = 2,
12 WeekDays = WeekdayType.Sunday | WeekdayType.Monday | WeekdayType.Friday,
13 },
14 RecurrenceRange =
15 new EndByRecurrenceRange
16 {
17 Start = new DateTime(2018, 7, 1, 8, 0, 0),
18 Finish = new DateTime(2018, 7, 20, 17, 0, 0),
19 }
20 }
21};
22project.RootTask.Children.Add(parameters);