Add Milestone in MS Project using Python

This short guide describes how to add milestone in MS Project using Python. It has details to set the IDE, a list of program steps, and sample code showing how to make a task milestone in MS Project using Python. You will get further details to customize the output MPP as per the requirements.

Steps to Add Milestone to MS Project using Python

  1. Set the environment to use Aspose.Tasks for Python via .NET to add a milestone
  2. Load the source MS Project file MPP into memory
  3. Add a new task under the desired task that will be turned into a milestone
  4. Set the task duration to zero as per the milestone task specifications
  5. Set the task flag to milestone using the is_milestone property
  6. Set the start date when this milestone will be achieved
  7. Save the updated project with the milestone on the disk

The given steps encompass how to create a milestone in Microsoft Project using Python. Load the source project file, add a task, set its milestone related parameters, and save it on the disk. The required parameters for a milestone task are zero duration, a true milestone flag, and a start date.

Code to Insert Milestone in MS Project using Python

This code shares details of how to make milestones in MS Project using Python. To avoid shifting of milestone task due to recalculation, you may set the constraint_type to MUST_START_ON and constraint_date. If you want to use a separate calendar for the milestone rather than the default project calendar, you may create the calendar in the project and assign it to the milestone task.

This article teaches the process for working with milestone tasks in a project. To add recurring task to a project, refer to the article Add Recurring Task in MS Project using Python.