Cross Project Predecessors
Contents
[
Hide
Show
]Microsoft Project lets users link tasks within the current project, or to external projects. Cross project predecessors are predecessors from another project. Aspose.Tasks for C++ API supports these too.
Working with Cross Project Predecessor Tasks
In Aspose.Tasks for C++ the CrossProjectName and IsCrossProject properties exposed by the TaskLink class are used to handle cross project predecessors.
- CrossProjectName represents the external predecessor project (string).
- IsCrossProject determines whether a predecessor is part of another project (Boolean).
To manage cross project predecessor tasks in Microsoft Project one can select Links between Projects from the Tools menu.
Getting cross project predecessor tasks using Aspose.Tasks
The code example given below demonstrates the predecessor/ successor task traversing the task links in the project.
1// Create project instance
2System::String dataDir = RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
3System::SharedPtr<Project> project1 = System::MakeObject<Project>(dataDir + u"GetCrossProjectTaskLinks.mpp");
4
5// Check cross project task links
6
7{
8 auto tsklnk_enumerator = (project1->get_TaskLinks())->GetEnumerator();
9 decltype(tsklnk_enumerator->get_Current()) tsklnk;
10 while (tsklnk_enumerator->MoveNext() && (tsklnk = tsklnk_enumerator->get_Current(), true))
11 {
12 if (tsklnk->get_IsCrossProject())
13 {
14 System::Console::WriteLine(tsklnk->get_CrossProjectName());
15 }
16 }
17}