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

Free Support Forum - aspose.com

Unable to replace calendar in a project


I am unable to replace a calendar using this code https://docs.aspose.com/tasks/net/creating-updating-and-removing-calendar/#replacing-a-calendar-with-a-new-calendar

Please provide solution.

Hi Robert,

Thank you for contacting Aspose support team.

Microsoft project does not allow deleting “Standard” calendar. Similarly Aspose.Tasks does not allow removing Standard calendar. You may please use following sample code to replace an existing calendar from the project and share the feedback.

Project project = new Project(@“Project1.mpp”);<o:p></o:p>

// Access project calendars

CalendarCollection calColl = project.Calendars;

foreach (ATasks.Calendar myCalendar in calColl)


if (myCalendar.Name == "TestCalendar")


// Remove calendar





// Add new calendar

ATasks.Calendar calendar = project.Calendars.Add("TestCalendar");