Hi,
I created a schedule with several tasks in Microsoft Project 2010. I then saved it as a Microsoft Project 2007 file type. I then try to read the tasks in the schedule, all of the date properties in the aspose.task object are either way off (not even close to what’s in the .mpp file) or just NULL. Here is the flow of my code.
Dim project as Aspose.Tasks.Project
Dim projectReader As New Aspose.Tasks.ProjectReader
Dim fileStream As New System.IO.FileStream(filePath, IO.FileMode.Open) //file path is correct
project = projectReader.Read(fileStream)
For Each taskObj As Aspose.Tasks.Task In project.RootTask.Children
//Each taskObj’s date properties are way off (sometimes 20 years off)
End For
*I have the license set before i am trying to read the task
Dim tasksLicense As Aspose.Tasks.License = New Aspose.Tasks.License() tasksLicense.SetLicense(“Aspose.Total.lic”)
*Now, if I open this file and save it as a Microsoft Project 2010 file, it now works (all the dates are correct)
*So it seems there is an issue when using Project 2010, creating a schedule, saving it as a 2007 project file, and using the aspose.Tasks api to read the tasks.
Any help or suggestions would be appreciated
Thanks
Hi,
Thanks for writing to Aspose.Tasks support team.
I have analyzed the information and tried to re-produce the issue using following steps:
- Using MSP 2010, created a new project
- Added few tasks in it with proper start and finish dates
- Saved this file as Microsoft Project 2007 file type.
- I read this file using your sample code
After execution of the program I could not re-produce the issue as all the start and finish dates were displayed properly.
In order to further investigate the issue I would request you to send me the sample MPP (in 2007 file format) which you used for your testing as it will help us to perform analysis and assist you as soon as possible.
Ok I sent the 2007 mpp file to you sir
Thanks
Hi,
Thank you for providing the sample file.
I would request you to please have a look at the attached screenshot which compares the output of the Aspose.Tasks with the sample MPP file in MSP. I have used the following code to read the information of all the tasks from your sample file:
License lic = new License();
lic.SetLicense("Aspose.Total.lic");
ProjectReader rdr = new ProjectReader();
Project prj = rdr.Read("Test Project 1 2007.mpp");
//Declare ChildTasksCollector class object
ChildTasksCollector collector = new ChildTasksCollector();
//Use TaskUtils to get all children tasks in RootTask
TaskUtils.Apply(prj.RootTask, collector, 0);
//Parse all the recursive children
foreach (Task tsk in collector.Tasks)
{
Console.WriteLine("Task= {0},Start = {1}, Finish = {2}", tsk.Name, tsk.Start, tsk.Finish.Date);
}
I would also like to add here that I am using the latest version of Aspose.Tasks for .NET 4.9.0 in my test application and executed this code without opening your provided sample file in MSP. Please give it a try using this latest version and let us know your feedback.
Ok, I will try that. Let me show you how I am doing it and maybe you can try it this way as well and tell me what I am doing wrong so I do not have to drastically change any of my code. I will attach what I have. Thanks
Ok, I have tried it your way with the file I had sent you before and ran into the same issue.
Dim license As New License
license.SetLicense(“Aspose.Total.lic”)
Dim reader As New ProjectReader
Dim project As Project = reader.Read(“Test Project 1 2007.mpp”)
Dim collector As New ChildTasksCollector
TaskUtils.Apply(project.RootTask, collector, 0)
For Each tsk As Task In collector.Tasks
Console.WriteLine(“Task = {0}, Start = {1}, Finish = {2}”, tsk.Name, tsk.Start.Date.ToString(“MM/dd/yyyy”), tsk.Finish.Date.ToString(“MM/dd/yyyy”))
Next
The output produced is attached
Thanks
Ok, tried using version 3.5 which results in the output I had attached in the previous post. Then I downloaded version 4.9 which results in the correct output including the correct dates. It looks as if it had something to do with the version? Any explanation on why it behaves differently in different versions?
Thanks again
Hi,
Thank you for your feedback and its good to know that the latest version solved your issue.
The version 3.5 is quite an older version now that you were using at your end. We improve our library by releasing a new version each month that not only solves a number of bugs reported by our valued customers, but may also contain some new features/enhancements. That is why we always recommend our users to use the latest version in their applications. You can also subscribe to the new Release notifications by enabling the Email subscription on the
Aspose.Tasks Release page to receive notifications about new release.