We are planning to use Aspose, and currently we are using trial version.
Hi Shivi,
Thank you for writing to Aspose support team.
Aspose.Tasks provides rich features to read/write and manipulate project files. Following are few sample codes which can be used to retrieve the required information.
public static void Email_714619_ProjectInfo()
{
Project project = new Project("file.mpp");
if (project.Get(Prj.ScheduleFromStart))
Console.WriteLine("Project Finish Date : " + project.Get(Prj.StartDate).ToShortDateString());
else
Console.WriteLine("Project Finish Date : " + project.Get(Prj.FinishDate).ToShortDateString());
Console.WriteLine(project.Get(Prj.Author));
Console.WriteLine(project.Get(Prj.LastAuthor));
Console.WriteLine(project.Get(Prj.Revision));
Console.WriteLine(project.Get(Prj.Keywords));
Console.WriteLine(project.Get(Prj.Comments));
}
public static void Email_714619_TimePhasedData()
{
Project project = new Project("Template2010.mpp");
project.Set(Prj.StartDate, new DateTime(2013, 10, 30, 9, 0, 0));
project.Set(Prj.NewTasksAreManual, false);
Task task = project.RootTask.Children.Add("Task");
Resource rsc = project.Resources.Add("Rsc");
rsc.Set(Rsc.StandardRate, 10);
rsc.Set(Rsc.OvertimeRate, 15);
// 6 days duration
task.Set(Tsk.Duration, project.GetDuration(6));
ResourceAssignment assn = project.ResourceAssignments.Add(task, rsc);
assn.Set(Asn.Stop, DateTime.MinValue);
assn.Set(Asn.Resume, DateTime.MinValue);
// backloaded contour increases task duration from 6 to 10 days
assn.Set(Asn.WorkContour, WorkContourType.BackLoaded);
project.SetBaseline(BaselineType.Baseline);
task.Set(Tsk.PercentComplete, 50);
List<TimephasedData> td = assn.GetTimephasedData(assn.Get(Asn.Start), assn.Get(Asn.Finish), TimephasedDataType.AssignmentRemainingWork).ToList();
Console.WriteLine(td.Count);
Console.WriteLine(td[0].Value);
Console.WriteLine(td[1].Value);
Console.WriteLine(td[2].Value);
Console.WriteLine(td[3].Value);
Console.WriteLine(td[4].Value);
Console.WriteLine(td[5].Value);
Console.WriteLine(td[6].Value);
}
As you are using trial version, you may get different dates than the actual dates in the project file. It is trial version limitation and you may get temporary license for 30 days to test all the features without any limitations. Please visit How to get temporary license section to get this license.
You may also visit the documentation section for more samples on Aspose.Tasks API.
Should you have any other query in this regard, please feel free to write us back.
Hello ,
Hi Shivi,
Thank you for writing to Aspose support team again.
If we thoroughly investigate the resource in the MPP project file, we can notice that resource does not contain time-phased data for AssignmentBaselineWork. The resource in the sample MPP project contains time phased data of type ResourceBaselineWork and ResourceBaselineCost only. You may please give a try to the following sample code and let us know the feedback.
Project project = new Project(“ProjectTest.mpp”);
Task task = project.RootTask.Children.GetByUid(1);
Resource resource = project.Resources.GetByUid(1);
DateTime start = project.Get(Prj.StartDate);
DateTime finish = project.Get(Prj.FinishDate);
//TimephasedDataCollection TimephasedVal = resource.GetTimephasedData(project.Get(Prj.StartDate), project.Get(Prj.FinishDate), TimephasedDataType.AssignmentBaselineWork);
TimephasedDataCollection ResourceBaselineWorkTimephasedVal = resource.GetTimephasedData(project.Get(Prj.StartDate), project.Get(Prj.FinishDate), TimephasedDataType.ResourceBaselineWork);
TimephasedDataCollection ResourceBaselineCostTimephasedVal = resource.GetTimephasedData(project.Get(Prj.StartDate), project.Get(Prj.FinishDate), TimephasedDataType.ResourceBaselineCost);