CreateTaskDefinition

ExtendedAttributeDefinition.CreateTaskDefinition method (1 of 2)

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 Tasks only. You are required to specify customFieldType, fieldId and alias when calling this method.

public static ExtendedAttributeDefinition CreateTaskDefinition(CustomFieldType customFieldType, 
    ExtendedAttributeTask fieldId, string alias)
Parameter Type Description
customFieldType CustomFieldType The specified CustomFieldType type.
fieldId ExtendedAttributeTask The specified ExtendedAttributeTask field ID.
alias String The specified String alias.

Return Value

Created instance of the ExtendedAttributeDefinition class with specified customFieldType, fieldId and alias.

Examples

Use this example to create a custom text field definition:

var taskTextAttr = ExtendedAttributeDefinition.CreateTaskDefinition(CustomFieldType.Text, ExtendedAttributeTask.Text27, "My custom field");
project.ExtendedAttributes.Add(taskTextAttr);

See Also


ExtendedAttributeDefinition.CreateTaskDefinition method (2 of 2)

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 Tasks only. You are required to specify fieldId and alias when calling this method. The field type is inferred from field id.

public static ExtendedAttributeDefinition CreateTaskDefinition(ExtendedAttributeTask fieldId, 
    string alias)
Parameter Type Description
fieldId ExtendedAttributeTask The specified ExtendedAttributeTask field ID.
alias String The specified String alias.

Return Value

Created instance of the ExtendedAttributeDefinition class with specified fieldId and alias.

Examples

Use this example to create a custom text field definition:

var taskTextAttr = ExtendedAttributeDefinition.CreateTaskDefinition(ExtendedAttributeTask.Text27, "My custom field");
project.ExtendedAttributes.Add(taskTextAttr);

See Also