Handling Priorities

Understanding Task Priorities

In Microsoft Project, priorities are used to guide automatic resource leveling — the process of resolving conflicts when a resource is over-allocated.

This mechanism helps Microsoft Project decide which tasks can be delayed or split during scheduling adjustments.

Working with Priorities in Aspose.Tasks

Aspose.Tasks for .NET provides access to task priorities through the Tsk class:

Checking Task Priority in Microsoft Project

To check or modify a task’s priority in Microsoft Project:

  1. Double-click the task in the Task Entry form.
  2. Go to the General tab.
  3. Adjust the Priority field.

Handling the task priority

Example: Reading Task Priority with Aspose.Tasks

The following example shows how to retrieve a task’s priority and output it to the console:

 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}

Key Notes

FAQ

Q: What happens if two tasks have the same priority?

Q: Can priorities be changed programmatically in Aspose.Tasks?

Q: Is the default priority always 500?

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.