This article teaches how to add recurring task in MS Project using C#. It includes details on setting up the IDE, a list of tasks defining the application logic, and sample code for working with Microsoft Project repeating tasks in C#. All the necessary API calls will be introduced to write and read recurring tasks in a Project file.
Steps to Make Recurring Task in Microsoft Project using C#
- Set the environment to use Aspose.Tasks for .NET to work with recurring tasks
- Apply the product license to use the product features without any restrictions
- Load the existing MPP file into the Project class object
- Define a new recurring task of a specific duration, occurring on desired days every week
- Set the recurrence start and end dates covering the whole duration
- Link the recurrence to a calendar in the loaded project
- Add this recurring task at a specific position in the existing project tasks
- Save the updated project and print the recurring task for confirmation
These steps summarize how to create repeating tasks in MS Project. Load an existing MS Project file into memory, instantiate a RecurringTaskParameters with the WeeklyRepetition attribute and a desired RecurrenceRange. Tie the recurrence to the project calendar, add the recurring task to the root task, and save the resultant MPP file.
Code to Make a Task Recurring in MS Project 2016 using C#
This sample code describes how to create Microsoft Project repeating tasks in C#. This code defines a date range for the recurring event; however, you can use EndByRecurrenceRange to limit the task by a fixed number of occurrences. You can save the resultant project file as a PDF or any other format supported by the enumerator SaveFileFormat.
This article has taught us the process to add recurring tasks in a Project. To open Primavera XER files, refer to the article Open XER file in C#.