Creating Tasks

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 for Java lets developers create tasks and define, at the time of creation, their name, and children or duration.

The default constructor creates an instance of a Task class without any parameter being passed. You can also create a named tasks by passing a String argument to its constructor

The following code demonstrates how to do this using Aspose.Tasks Java API.

1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2// The path to the documents directory.
3String dataDir = Utils.getDataDir(CreateTasks.class);
4
5Project project = new Project();
6Task task = project.getRootTask().getChildren().add("Summary1");
7Task subtask = task.getChildren().add("Subtask1");
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.