Improved Extended Attributes Implementation with Aspose.Tasks for .NET 17.1.0

Share on FacebookTweet about this on TwitterShare on LinkedIn

We are pleased to announce the release of Aspose.Tasks for .NET 17.1.0. This month’s release brings improvement to the public API for working with custom fields of a project. The new implementation makes it simple for creating extended attributes. This release also fixes a number of bugs reported with earlier version of the API. For a complete list of what is new and fixed with this release of version, please visit the release notes section of Aspose.Tasks for .NET documentation.

Enhancements

Improved Public API for working with Custom Fields: Yes, we have improved the public API for working with custom fields i.e. Tasks as well as Resources. The improved version of this API simplifies adding an extended attribute definition to project and create extended attribute from this definition. The new implementation provides individual implementations for working with plain and lookup custom fields. The following static methods of ExtendedAttributeDefinition class allow the creation of each type of extended attribute.

The sample below shows a basic illustration of this improved implementation for creating a Task lookup extended attribute. Code sample, for working with plain task and resource as well as resource lookup extended attribute can be referred to in our documentation article.

Project project1 = new Project(dataDir + "Blank2010.mpp");

//Create an Extended Attribute Definition of Text2 type
var taskExtendedAttributeText2Definition = ExtendedAttributeDefinition.CreateLookupTaskDefinition(CustomFieldType.Text, ExtendedAttributeTask.Text2, "Task Towns Name");

//Add lookup values for the extended attribute definition
taskExtendedAttributeText2Definition.AddLookupValue(new Value { Id = 1, StringValue = "Town1", Description = "This is Town1" });
taskExtendedAttributeText2Definition.AddLookupValue(new Value { Id = 2, StringValue = "Town2", Description = "This is Town2" });

//Add it to the porject's Extended Attributes collection
project1.ExtendedAttributes.Add(taskExtendedAttributeText2Definition);

//Add a task to the project
var task2 = project1.RootTask.Children.Add("Task 2");

//Crate an Extended Attribute from the Text2 Lookup Definition for Id 1
var taskExtendedAttributeText2 = taskExtendedAttributeText2Definition.CreateExtendedAttribute(taskExtendedAttributeText2Definition.ValueList[1]);

//Add the Extended Attribute to task
task2.ExtendedAttributes.Add(taskExtendedAttributeText2);

project1.Save(dataDir + "TextExtendedAttributeWithLookup_out.mpp", SaveFileFormat.MPP);

Other Improvements

This month’s release also fixes several bugs that improves the overall API functionality. These touch different functional areas of the API, including:

  • Working with Extended Attributes of the API
  • Lookup values error while assigning to task
  • Large file size after creating task baseline
  • Saving Extended Task Attributes to output MPP

API Resources

You may visit the following API resources for getting started and working with the API.

  • Product Documentation – Detailed API documentation with code examples and details about API functional areas
  • Aspose.Tasks Forum – Our online support forum where we address your queries and inquiries