Creating Fixed duration tasks

Hi,


how can I create fixed duration tasks using this API?

Hi Aaron,

You can use the Tsk.Duration property to set the duration of a task as shown in the following code sample. Please try it at your end and share your feedback with us.

Code:

Project project = new Project(“New project 2010.mpp”);
Task task = project.RootTask.Children.Add("Task 1");
task.Set(Tsk.Start, new DateTime(2015, 5, 27));
task.Set(Tsk.Duration, project.GetDuration(8, TimeUnitType.Hour));
project.Save("1.mpp", SaveFileFormat.MPP);