Creating a Task Link

Contents
[ Hide Show ]

A task link is created using the default constructor of TaskLink class which accepts three parameters:

  1. The first parameter defines the predecessor Task,
  2. the second parameter defines the successor Task and, finally,
  3. the third parameter defines the task link type from values specified by the TaskLinkType enumeration type.

The following example creates a link between two tasks with Task1 as predecessor.

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(CreateTaskLink.class);
4
5Project project = new Project();
6Task pred = project.getRootTask().getChildren().add("Task 1");
7Task succ = project.getRootTask().getChildren().add("Task 2");
8TaskLink link = project.getTaskLinks().add(pred, succ);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.