Predecessor and Successor Tasks

The PredTask and SuccTask properties exposed by the TaskLink class are used to define the predecessor and successor tasks for a TaskLink. Both of these properties read and write Task object.

Working with Predecessor and Successor Tasks

To manage predecessor tasks in Microsoft Project:

  1. From the View menu, select More Views and then Task Entry Form.
  2. Double-click the desired task.# Select the Predecessor tab.

Viewing predecessor tasks in Microsoft Project

checking predecessor/successors tasks in Microsoft Project 2019

Getting Predecessor Tasks with Aspose.Tasks

The code sample below displays the predecessor and successor task after traversing the task links in the project and writing the results to a console window.

 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(PredecessorSuccessorTasks.class);
 4
 5Project project = new Project(dataDir + "Input.mpp");
 6TaskLinkCollection allinks = project.getTaskLinks();
 7for (TaskLink tsklnk : allinks) {
 8    System.out.println("Predecessor " + tsklnk.getPredTask().get(Tsk.NAME));
 9    System.out.println("Successor " + tsklnk.getSuccTask().get(Tsk.NAME));
10}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.