Creating Tasks

Contents
[ Hide Show ]

A project is, essentially, made up by a number of tasks, each of which has to be completed for the project to be completed. When working with project files, adding tasks is an important activity. Tasks are often linked to other tasks, to indicate dependency, and typically have a set duration. Aspose.Tasks let developers create tasks and define, at the time of creation, their name, and children or duration.

Creating Tasks

The Task class exposes the Add method for adding a task to a project’s root or other tasks. The following code sample shows how this can be achieved.

The default constructor creates a Task instance without any parameter being passed.

1Project project = new Project();
2
3// Add task, sub task and save project
4Task task = project.RootTask.Children.Add("Summary1");
5Task subtask = task.Children.Add("Subtask1");
6project.Save("CreateTasks_out.xml", SaveFileFormat.XML);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.