Free Support Forum - aspose.com

Get Baseline Start and Finish Dates

Hello - is there a method to getBaseline by ID?

I use ArrayList rA = project.GetResourceAssignmentsByTask(task);

Goal of request: Output id, uid, start, finish, baseline.start, baseline.finish and other fields. I have everything working except how to get to the baseline data.

Can you provide sample code please or point me to documentation?

Thanks in advance

Hi Len,

You can use the following code if you want to read a specific baseline of a specific task

Task task = project.GetTaskById(1);<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

foreach (Aspose.Tasks.TaskBaseline baseline in task.Baseline)

{

switch (baseline.BaselineNumber)

{

case BaselineType.Baseline:

Console.WriteLine("Baseline Start: " + baseline.Start);

Console.WriteLine("Baseline Finish: " + baseline.Finish);

break;

case BaselineType.Baseline1:

Console.WriteLine("Baseline1 Start: " + baseline.Start);

Console.WriteLine("Baseline1 Finish: " + baseline.Finish);

break;

default:

break;

}

}

or you can use the following code if you want to read all baselines of all the tasks

ChildTasksCollector collector = new ChildTasksCollector();

TaskUtils.Apply(project.RootTask, collector, 0);

foreach (Task task in collector.Tasks)

{

foreach (Aspose.Tasks.TaskBaseline baseline in task.Baseline)

{

Console.WriteLine(baseline.BaselineNumber + Environment.NewLine + "Start: " +

baseline.Start + Environment.NewLine + "Finish: " + baseline.Finish);

}

}

Please check these topics http://www.aspose.com/documentation/.net-components/aspose.tasks-for-.net/working-with-task-baselines.html for more details and feel free to contact us in case you have further comments or questions.

Best Regards,