Async a calendar to a task

In MS Project, we have the option to perform the calendaring of tasks, as we can see in the image below.

image.png (53.9 KB)

For this link we make the following code “TaskObject.Set(Tsk.Calendar, CalendarObject);”

However when querying the XML and MPP, generated at the end of the process, the tasks in MPP file are without the calendar information:

image.png (942 Bytes)

The XML file have assigned calendar, but in MSProject not.

@henrique.ramos,

I have analyzed the requirement and need little assistance. Could you please inform which version of Microsoft Project(MSP) are you using? We need to perform this task using MSP first and then perform analysis accordingly.

We’re using MSP 2016.

@FabioMartins,

I have tried the following sample code and it works fine as it sets the specific calendar id to a task. Please give it a try and share the feedback.

Project proj = new Project(@“sample.mpp”);
var cal = proj.Calendars.GetByUid(4);
Task tsk1 = proj.RootTask.Children.GetById(1);
tsk1.Set(Tsk.Calendar, cal);
proj.Save(@“output.xml”, SaveFileFormat.XML);
proj.Save(@“output.mpp”, SaveFileFormat.MPP);

SampleData.zip (51.4 KB)

@kashif.iqbal

In this example, the calendar is not linked.

Project proj = new Project(@“Sample.mpp”);
proj.CalculationMode = CalculationMode.None; //cause

var cal = proj.Calendars.Add(“CalendarTest1”);

Task tsk1 = proj.RootTask.Children.Add(“TaskTest1”);
tsk1.Set(Tsk.Calendar, cal);

proj.Recalculate();
proj.Save(@“output.xml”, Aspose.Tasks.Saving.SaveFileFormat.XML);
proj.Save(@“output.mpp”, Aspose.Tasks.Saving.SaveFileFormat.MPP);

Could you explain the reason?

@FabioMartins,

Thank you for providing more details. This issue is observed and logged under Id:TASKSNET-2381 for detailed analysis. We will write back here once analysis is done and feedback is ready to share.

Hi,
Any news?

@FabioMartins,

This has been fixed in v 18.5 of the API which you can download from here.