Aspose Task to update Summary task properties


#1

Hello Team,
Am trying to set start and end date for the summary task as below

		string testTemplate = "2013ProjectTemplate.mpt"; //Can set any mpt file of your choice
		Project oMPPPRoj = new Project(sPath + testTemplate);
		DateTime projectstartdate = Convert.ToDateTime("02-Jul-2017");
		DateTime projectenddate = Convert.ToDateTime("09-Jul-2017");

		oMPPPRoj.Set(Prj.StartDate, projectstartdate);
		oMPPPRoj.Set(Prj.FinishDate, projectenddate);
		
		oMPPPRoj.Save("OutputMPP.mpp", Aspose.Tasks.Saving.SaveFileFormat.MPP);

When I open the output file the finish date is coming as 02-Jul-2017 instead of 09-Jul-2017. I was checking other links



https://docs.aspose.com/display/tasksnet/Handling+Task+Constraints?showComments=true&showCommentArea=true

But none of them are helping to solve my current problem. Please let me know how I could set this desired value.

Thank you,
RajeshKumar.


#2

@Rajeshrv

You may set the start and end date for summary task as given below:

Task task = project.RootTask;
            
task.Set(Tsk.Start, new DateTime(2017, 7, 2));
task.Set(Tsk.Finish, new DateTime(2017, 7, 9)); 

Moreover, please write back to us if you need any additional information in this regard.


#3

@MuzammilKhan
I even tried this way, it didn’t work. Please let me know any other options.


#4

@Rajeshrv

Please share your project file and let us investigate it. Project summary task is linked with sub tasks so start and end date of summary task is dependent on sub tasks.

Moreover, you may try after setting project calculation mode to manual as follows:

project.CalculationMode = CalculationMode.Manual;


#5

@MuzammilKhan
I have uploaded my template file, 2013ProjectTemplate.zip (28.1 KB)

My current requirement is to set the summary task (start/end) date and sub task (start/end) date differently, so setting a subtask (task 1 start and end date) is not solving the purpose.

Thank you.


#6

@Rajeshrv

Thank you for your feedback.
We are investigating this issue and you will be updated here as soon as we have any information to share in this regard.


#7

@Rajeshrv

We have logged this issue with ID “TASKSNET-2855” for further investigation. You will automatically be informed here once we have more information to share.


#8

@Rajeshrv

It is requested to please try the following code sample using Aspose.Tasks for .NET 18.11 and share your feedback with us.

Project project = new Project(path + "2013ProjectTemplate.mpt")
{
    CalculationMode = CalculationMode.Manual
};
Task task = project.RootTask.Children.Add("t");

task.Set(Tsk.Start, new DateTime(2017, 7, 2, 8, 0, 0));
task.Set(Tsk.Finish, new DateTime(2017, 7, 9, 17, 0, 0));
project.Recalculate();

Console.WriteLine(task.Get(Tsk.Duration));
project.Save(path + "2013ProjectTemplate_out.mpp", SaveFileFormat.MPP);

#9

@MuzammilKhan
I would like to re-iterate my requirement, I have a situation where I should populate summary task (start/end) and sub task (start/end) dates differently. By executing above lines of code, it would create a task id 1 and assigns the date also updates the task id 0 (summary task) date with the same.
So please let me know the options for doing the same.

Thank you.


#10

@Rajeshrv Hello!

Could you please share with us the MPP file generated by MS Project in which summary task dates are different from the child ones?

Moreover, Aspose.Tasks automatically calculates the fields of summary tasks and we are unable to reproduce this issue with such files where the dates of summary and child are different.

Thank you.


#11

@alexanderefremov1, @MuzammilKhan

This is the code I tried, and attached the file which got created after executing the same.

SavedMPP.zip (27.6 KB)

		string testTemplate = "2013ProjectTemplate.mpt";
		Project oMPPPRoj = new Project(sPath + testTemplate)
		{
			CalculationMode = CalculationMode.Manual
		};
		DateTime projectstartdate = Convert.ToDateTime("03-Jul-2017");
		DateTime projectenddate = Convert.ToDateTime("10-Jul-2017");
		oMPPPRoj.Set(Prj.StartDate, projectstartdate);
		oMPPPRoj.Set(Prj.FinishDate, projectenddate);

		Aspose.Tasks.Task tsk = oMPPPRoj.RootTask.Children.Add("Task 1");
		DateTime tskstartdate = Convert.ToDateTime("05-Jul-2017");
		DateTime tskenddate = Convert.ToDateTime("07-Jul-2017");
		tsk.Set(Tsk.Start, tskstartdate);
		tsk.Set(Tsk.Finish, tskenddate);

		//oMPPPRoj.Recalculate();//You could try both uncomment & check for same behavior

		//tsk.Set(Tsk.ConstraintType, ConstraintType.AsSoonAsPossible);
		//tsk.Set(Tsk.ConstraintDate, projectenddate);

		oMPPPRoj.Save("SavedMPP.mpp", Aspose.Tasks.Saving.SaveFileFormat.MPP);  

Thank you.


#12

@Rajeshrv

Thank you for your feedback.
Can you please elaborate what actually are you trying to do? Can you please create a sample project using MS Project (not by using Aspose.Tasks library) and attach MPP file here? So that we could find the difference in behavior of Aspose.Tasks and MS Project.

For now, Aspose.Tasks is always do the same calculations as MS Project and if MS Project recalculates the summary dates after child’s have been changed it is the right behavior and our API will do the same.


#13

@alexanderefremov1
Currently am unable to edit the summary task’s (task 0) start and end date using Project 2013, so I feel this is how the behavior is derived in AT as well. Let me check whether any option where I could do this manually in MS Project and then get back to Aspose.

Thank you.


#14

@Rajeshrv

Thank you for your feedback.
Please check with scheduling mode it may have set automatic. Please write back to us and share manually created MPP with us.


#15

The issues you have found earlier (filed as TASKSNET-2855) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan