Handling Priorities

A task’s priority helps Microsoft Project with automatic resource levelling (a process of fixing conflicts when a resource is over-allocated). In Microsoft Project, it is possible to assign priority values between 0 and 1000 (where 0 is the lowest priority). By default, tasks are assigned the value 500.

Working with Priorities

The priorities associated with a class are handled through the Priority property exposed by the Tsk class.

Task priorities in Microsoft Project

To handle a task’s priority in Microsoft Project one need to double-click on a task in the Task Entry form:

handling the task priority

Getting a Task’s Priority

The following examples show how to get a task’s priority and write it to a console window using Aspose.Tasks.

 1Project project = new Project("New Project.mpp");
 2
 3// Create a ChildTasksCollector instance
 4ChildTasksCollector collector = new ChildTasksCollector();
 5
 6// Collect all the tasks from RootTask using TaskUtils
 7TaskUtils.Apply(project.RootTask, collector, 0);
 8
 9// Display Priorities for all tasks
10foreach (Task task in collector.Tasks)
11{
12    Console.WriteLine(task.Get(Tsk.Name) + " - Priority : " + task.Get(Tsk.Priority).ToString());
13}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.