Defining Link Type
Contents
[
Hide
Show
]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.
Defining Link Type
To define link type in Microsoft Project:
- On the View menu, select More Views and then Task Entry Form.
- Double-click the desired task.
- Select the Predecessor tab.
Defining link type in Microsoft Project
Setting Link Type with Aspose.Tasks
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);
Getting Link Type with Aspose.Tasks
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}