ExtendedAttributeDefinitionCreateResourceDefinition Method (ExtendedAttributeResource, String)

Factory method which creates a simple extended attribute definition, which Microsoft Project shows as "None". It has CalculationType equals to None and can be used in Resource only. You are required to specify fieldId and alias when call this method. The field type is inferred from field id.

Namespace:  Aspose.Tasks
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 21.5
Syntax
public static ExtendedAttributeDefinition CreateResourceDefinition(
	ExtendedAttributeResource fieldId,
	string alias
)

Parameters

fieldId
Type: Aspose.TasksExtendedAttributeResource
The specified ExtendedAttributeResource field ID.
alias
Type: SystemString
The specified String alias.

Return Value

Type: ExtendedAttributeDefinition
Created instance of the ExtendedAttributeDefinition class with specified fieldId and alias.
Examples
Use this example to create a custom text field definition:
var resourceTextAttr = ExtendedAttributeDefinition.CreateResourceDefinition(ExtendedAttributeResource.Text27, "My custom field");
project.ExtendedAttributes.Add(resourceTextAttr);
Examples
Shows how to create extended attribute definition and set a value of a flag while its constructing.
var project = new Project(DataDir + "Project2.mpp");

var resource = project.Resources.Add("Resource 1");
resource.Set(Rsc.Type, ResourceType.Cost);

// create a definition for a boolean custom field
var definition = ExtendedAttributeDefinition.CreateResourceDefinition(ExtendedAttributeResource.Flag7, "My Custom Flag");

// create an attribute and set the initial value to 'true'
var attribute = definition.CreateExtendedAttribute(true);
resource.ExtendedAttributes.Add(attribute);
See Also