Changing Task Progress
Why Change Task Progress?
Tracking and updating task progress is essential for project management. In Microsoft Project, progress is usually recorded as % Complete.
With Aspose.Tasks for .NET, developers can programmatically set a task’s progress, which is especially useful for automated reporting, synchronization with external systems, or bulk updates.
API for Task Progress
The Task class provides the method:
SetPercentComplete(int percent)
- Input:
int
value (0–100) - Effect: Updates the task’s percentage completion.
- Input:
This directly corresponds to the % Complete field in Microsoft Project.
Example: Changing Task Progress in C#
Here’s how to update the progress of a task programmatically:
1Project project = new Project();
2Console.WriteLine("Project Calculation mode is Automatic: {0}", project.CalculationMode.Equals(CalculationMode.Automatic));
3
4Task task = project.RootTask.Children.Add("Task");
5task.Set(Tsk.Duration, project.GetDuration(2));
6task.Set(Tsk.PercentComplete, 50);
Tip: Updating task progress can also affect actual start/finish dates and remaining duration, depending on the project settings.
Key Benefits
- Automates progress tracking without opening Microsoft Project.
- Useful for integrations with ERP/CRM systems.
- Ensures consistency across large projects with many tasks.
- Supports saving changes back to
.mpp
and other formats.
FAQ
Q: Can I set progress greater than 100%?
- No. The valid range is 0–100.
Q: Does changing progress automatically update ActualWork
or RemainingWork
?
- Yes, depending on the project’s calculation settings.
Q: Can I partially update multiple tasks at once?
- Yes. You can iterate through the
TaskCollection
and callSetPercentComplete()
for each task.