This simple article provides details about how to add Weekdays in MPP using C# by providing details about setting up the environment and using the example code. It encompasses all the necessary resources that are required to develop this application without any dependence on MS Project or any other MPP managing software to define weekdays in Microsoft Project using C#.
Steps to Add Weekdays inside MPP file using C#
- Establish the development environment to include Aspose.Tasks for .NET using the NuGet package manager
- Create a new MPP file using an instance of the Project class
- Create an instance of the Calendar class to add a new calendar and weekdays
- Add working times for the specific half days and add them to the calendar
- Save the resultant project file as an MPP file on the disk
The aforementioned steps in C# add weekdays inside MPP file using very simple API calls. The process will commence by loading an existing or creating a new MPP file using an instance of the Project class. Then by using an instance of Calendar class, a new calendar including days of the week will be added, which is then followed by adding working times for the day. Finally, the MPP file is saved on the disk by using the SaveFileFormat enumerator.
Code to Define Weekdays in MPP using C#
In order to add weekdays inside MPP file in C#, we will start by loading an MPP file or creating a new one from scratch. The Calendar class allows you to add different types of calendars including 24 hours shifts, night and standard ones. You can set any day to work and also set working times for a specific day using the WorkingTime class instance. The Project file can be saved to other formats including MPP, XML and PDF.
In this topic, we have learnt how to define weekdays in MPP file using C#. If you are interested in converting an MPP to an SVG, follow the article on how to convert MPP to SVG using C#.