Identifier les tâches du projet croisé
Contents
[
Hide
Show
]Comment identifier les tâches du projet croisé
Si vous avez lié une tâche d’un projet à une tâche de l’autre projet, les IDS et les UID de la tâche sont différents dans les projets originaux et externes comme vous pouvez le voir dans l’image suivante.
IDS internes et externes dans Microsoft Project
La propriété externalid exposée par la classe tâche est utilisée pour trouver l’ID d’origine d’une tâche externe. La propriété ID renvoie l’ID de la tâche externe dans le projet externe tandis que la propriété externalid renvoie l’ID de la tâche externe dans le projet original.
L’exemple de code ci-dessous trouve l’ID d’origine et externe d’une tâche.
1// Create project instance and access task
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"External.mpp");
4System::SharedPtr<Task> externalTask = project1->get_RootTask()->get_Children()->GetByUid(1);
5
6// Show ID of the task in the external project
7System::Console::WriteLine(System::Convert::ToString(externalTask->Get<int32_t>(Tsk::Id())));
8
9// Show ID of the task in the original project
10System::Console::WriteLine(System::Convert::ToString(externalTask->Get<int32_t>(Tsk::ExternalId())));