MS Project Outline Code Handling Definitions in Aspose.Tasks

Introduction

Microsoft Project is a powerful tool for managing projects, and Aspose.Tasks for .NET provides comprehensive support for manipulating project files programmatically. One essential aspect of project management is organizing tasks using outline codes. In this tutorial, we’ll explore how to handle MS Project outline code definitions using Aspose.Tasks for .NET.

Prerequisites

Before we dive into the implementation, make sure you have the following prerequisites:

1. Installation of Aspose.Tasks for .NET

Ensure you have installed Aspose.Tasks for .NET in your development environment. You can download it from here.

2. Basic Understanding of C# and .NET Framework

Familiarize yourself with C# programming language and the .NET framework as this tutorial requires intermediate-level C# knowledge.

3. Integrated Development Environment (IDE)

Have an IDE such as Visual Studio installed on your system for coding and debugging.

Import Namespaces

Before we start coding, let’s import the necessary namespaces to work with Aspose.Tasks for .NET.

using Aspose.Tasks;
using System;

using Aspose.Tasks.Saving;

Now, let’s break down the provided example into multiple steps for a clear understanding.

Step 1: Load the Project File

First, we need to load the MS Project file into our application.

String DataDir = "Your Document Directory";
var project = new Project(DataDir + "OutlineValues2010.mpp");

Step 2: Create Outline Code Definition

Now, let’s create a new outline code definition.

var outline = new OutlineCodeDefinition();

Step 3: Set Field Number and Name

Set the field number and name for the outline code.

outline.FieldId = ExtendedAttributeTask.OutlineCode7.ToString("D");
outline.FieldName = "Outline Code1";

Step 4: Set GUID and Other Properties

Set the GUID and other properties of the outline code.

outline.Guid = "e6afac06-0d86-4359-a96c-db705e3d2ca8";
outline.LeafOnly = false;
outline.Alias = "My Outline Code";
outline.PhoneticAlias = "Outline Code";
outline.AllLevelsRequired = true;
outline.Enterprise = false;
outline.EnterpriseOutlineCodeAlias = 0;

Step 5: Add Outline Mask

Add an outline mask to the outline code.

var mask = new OutlineMask();
mask.Type = MaskType.Characters;
outline.Masks.Add(mask);

Step 6: Set Other Properties

Set additional properties of the outline code.

outline.OnlyTableValuesAllowed = false;
outline.ResourceSubstitutionEnabled = false;
outline.ShowIndent = false;

Step 7: Add Outline Value

Finally, let’s add an outline value to the outline code.

var value = new OutlineValue();
value.Value = "Text value 1";
value.ValueId = 1;
value.Type = OutlineValueType.Text;
value.Description = "Text value descr 1";
outline.Values.Add(value);

Conclusion

In this tutorial, we’ve learned how to handle MS Project outline code definitions using Aspose.Tasks for .NET. By following the step-by-step guide, you can efficiently manipulate outline codes in your project files programmatically.

FAQ’s

Q1: Can I use Aspose.Tasks for .NET with different versions of MS Project files?

A: Yes, Aspose.Tasks for .NET supports various versions of MS Project files, including MPP and XML formats.

Q2: Is Aspose.Tasks for .NET compatible with .NET Core?

A: Yes, Aspose.Tasks for .NET is compatible with .NET Core, allowing you to develop cross-platform applications.

Q3: Can I manipulate resource assignments using Aspose.Tasks for .NET?

A: Yes, Aspose.Tasks for .NET provides extensive features for manipulating resource assignments, including adding, updating, and removing assignments.

Q4: Does Aspose.Tasks for .NET support reading custom fields from MS Project files?

A: Absolutely, Aspose.Tasks for .NET supports reading and writing custom fields, including outline codes, from MS Project files.

Q5: Is there a community forum for Aspose.Tasks for .NET?

A: Yes, you can join the community forum for Aspose.Tasks for .NET here to ask questions, share knowledge, and collaborate with other developers.