CreateResourceDefinition

ExtendedAttributeDefinition.CreateResourceDefinition 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 Resource only. You are required to specify customFieldType, fieldId and alias when call this method.

public static ExtendedAttributeDefinition CreateResourceDefinition(CustomFieldType customFieldType, 
    ExtendedAttributeResource fieldId, string alias)
Parameter Type Description
customFieldType CustomFieldType The specified CustomFieldType type.
fieldId ExtendedAttributeResource The specified ExtendedAttributeResource 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 resourceTextAttr = ExtendedAttributeDefinition.CreateResourceDefinition(CustomFieldType.Text, ExtendedAttributeResource.Text27, "My custom field");
project.ExtendedAttributes.Add(resourceTextAttr);

See Also


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

public static ExtendedAttributeDefinition CreateResourceDefinition(
    ExtendedAttributeResource fieldId, string alias)
Parameter Type Description
fieldId ExtendedAttributeResource The specified ExtendedAttributeResource 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 resourceTextAttr = ExtendedAttributeDefinition.CreateResourceDefinition(ExtendedAttributeResource.Text27, "My custom field");
project.ExtendedAttributes.Add(resourceTextAttr);

See Also