Defining Link Type

The LinkType property exposed by the TaskLink class is used to retrieve or define the type of link between two tasks. It reads and writes one of the values defined by the TaskLinkType enumeration type.

To define link type in Microsoft Project:

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

Defining link type in Microsoft Project

show task link type Microsoft Project

The code samples below set a link type as “Finish-to-Start”, the default link type.

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(DefineLinkType.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);
9link.setLinkType(TaskLinkType.StartToStart);
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(DefineLinkType.class);
4
5Project project = new Project("Input.mpp");
6TaskLinkCollection allinks = project.getTaskLinks();
7for (TaskLink tsklnk : allinks) {
8    System.out.println(tsklnk.getLinkType());
9}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.