Setting Recurring Task Parameters in Aspose.Tasks
Introduction
In this tutorial, we will guide you through the process of setting Microsoft Project recurring task parameters using Aspose.Tasks for .NET.
Prerequisites
Before you begin, ensure you have the following:
- Basic understanding of C# programming language.
- Installed Visual Studio or any other C# IDE.
- Aspose.Tasks for .NET library installed and referenced in your project.
Import Namespaces
Firstly, you need to import the necessary namespaces in your C# code:
using Aspose.Tasks;
using System;
Step 1: Define the Document Directory
String DataDir = "Your Document Directory";
Replace "Your Document Directory"
with the path to your document directory.
Step 2: Load the Project File
var project = new Project(DataDir + "Blank2010.mpp");
This line of code loads the Microsoft Project file into the project
variable.
Step 3: Define Recurring Task Parameters
var parameters = new RecurringTaskParameters
{
TaskName = "Recurring task",
Duration = project.GetDuration(1, TimeUnitType.Day),
RecurrencePattern = new WeeklyRecurrencePattern
{
Repetition = new WeeklyRepetition
{
RepetitionInterval = 2,
WeekDays = WeekdayType.Sunday | WeekdayType.Monday | WeekdayType.Friday
},
RecurrenceRange = new EndByRecurrenceRange
{
Start = new DateTime(2018, 7, 1, 8, 0, 0),
Finish = new DateTime(2018, 7, 20, 17, 0, 0)
}
},
IgnoreResourceCalendar = false
};
Here, you define the parameters for the recurring task such as task name, duration, recurrence pattern, recurrence range, and whether to ignore the resource calendar.
Step 4: Set Calendar for Recurring Task
parameters.SetCalendar(project, "Standard");
This step sets the calendar for the recurring task. In this example, it sets the calendar to “Standard”.
Step 5: Add Parameters to Project
project.RootTask.Children.Add(parameters);
Finally, add the parameters to the project’s root task.
Conclusion
In this tutorial, we’ve demonstrated how to set Microsoft Project recurring task parameters using Aspose.Tasks for .NET. By following these steps, you can efficiently manage recurring tasks in your projects.
FAQs
Can I customize the recurrence pattern further?
Yes, Aspose.Tasks provides various recurrence patterns and options to customize according to your project requirements.
Is there a trial version available before purchasing?
Yes, you can download a free trial from the Aspose.Tasks website to evaluate the library’s features.
Does Aspose.Tasks support other project file formats?
Yes, Aspose.Tasks supports various project file formats including MPP, XML, XLSX, and more.
Can I get support if I encounter any issues during implementation?
Yes, you can visit the Aspose.Tasks forum for assistance from the community or contact support for direct help.
How can I obtain a temporary license for Aspose.Tasks?
You can obtain a temporary license from the website for testing purposes.