We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Modify existing Task using aspose Task


I want to ask the following:
Loads an existing MS Project xml file using Aspose. Now for one task changes the start date and finish date, for example. This task is “Predecessor” for other tasks. As the simplest writing these changes to my XML file? I have to write my own methods that override the values ​​in all relevant fields, or there’s some Aspose to function?

Thanks and BR

Hi Otomar,

Thank you for considering Aspose.Tasks.

With respect to your query, you can change the start date of a task and all other tasks will be rescheduled accordingly. Please have a look at the following sample code for your reference and let us know if you have any other query/inquiry in this regard.

Sample Code:

<span style=“font-size:
10.0pt;font-family:“Courier New”;color:#2B91AF;mso-no-proof:yes”>Project<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> project = newProject(“ProjWith3TasksMan.xml”);<o:p></o:p>

Task tsk = project.GetTaskById(1);


Console.WriteLine("Start Date: " + tsk.Start);

tsk.Start = tsk.Start.AddDays(1);


project.Save("ProjWith3TasksMan_Updated.xml", Aspose.Tasks.Saving.SaveFileFormat.XML);


Thank you for your reply. I tried your advice, but “without success”.
In attached file is my original project created by MS Project 2010.
(See uploaded file: OneParent.xml in MyTestProject.zip )
But when I read the rewrite file using followed code:

Aspose.Tasks.Project project = new Aspose.Tasks.Project(“OneParent.xml”);
var task = project.GetTaskByUid(2);
var durUnit = project.MinutesPerDay / 60;
task.Start = task.Start.AddDays(7);
project.Save(“OneParent_Rewrite.xml”), Aspose.Tasks.Saving.SaveFileFormat.XML);

(See uploaded file: OneParent_Rewrite.xml in MyTestProject.zip )

After reading this file in MS Project it looks without changes.
Start and Finish dates have original values and property ‘ConstraintType’ is changed,
as well as items: 'TotalSlack and ‘FinishSlack’ too.

Why is this so? Where possible difficulty?

Thanks and BR

Hi Otomar,

Thank you for contacting Aspose support team.

I have analyzed the code and sample project file. I would like to share that all the tasks in your project are manually scheduled therefore you are not observing any change there. Could you please test your sample code with the attached file containing auto scheduled tasks and let us know your feedback?