Identify Cross-Project Tasks

Linking tasks between projects

If you have linked a task from one project to a task from the other project, the IDs and UIDs of the task is different in the original and external projects as you can see in the following image.

Internal and external IDs in Microsoft Project

viewing cross project links

The ExternalId property exposed by the Task class is used to find an external task’s original ID. The Id property returns the ID of the external task in the external project whereas the ExternalId property returns the ID of the external task in the original project.

The code below finds the original and external ID of a task.

 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(IdentifyCrossProjectTasks.class);
 4
 5Project externalProject = new Project(dataDir + "External.mpp");
 6
 7Task externalTask = externalProject.getRootTask().getChildren().getByUid(4);
 8// ID of the task in the external project
 9System.out.println(externalTask.get(Tsk.ID).toString());
10// ID of the task in the original project
11System.out.println(externalTask.get(Tsk.EXTERNAL_ID).toString());
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.