Class ExtendedAttributeDefinition
Namespace: Aspose.Tasks
Assembly: Aspose.Tasks.dll (25.2.0)
Represents an extended attribute definition associated with a project.
[ClassInterface(ClassInterfaceType.AutoDual)]
public class ExtendedAttributeDefinition
Inheritance
object ← ExtendedAttributeDefinition
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Properties
Alias
Gets or sets the alias of a custom field.
public string Alias { get; set; }
Property Value
AppendNewValues
Gets or sets a value indicating whether new values added to a project are automatically added to the list.
public bool AppendNewValues { get; set; }
Property Value
Remarks
Currently supported for MSP 2003/2007 Xml and MSP 2003 mpp formats.
AutoRollDown
Gets or sets a value indicating whether an automatic roll down to assignments is enabled.
public bool AutoRollDown { get; set; }
Property Value
CalculationType
Gets or sets the type of calculation of the custom attribute’s value.
public CalculationType CalculationType { get; set; }
Property Value
CfType
Gets the type of a custom field.
public CustomFieldType CfType { get; }
Property Value
Default
Gets or sets the default value in the list.
public string Default { get; set; }
Property Value
Remarks
Currently supported for MSP 2003/2007 Xml and MSP 2003 mpp formats.
DefaultGuid
Gets or sets the Guid of the default lookup table entry.
public string DefaultGuid { get; set; }
Property Value
ElementType
Gets or sets the extended attribute is associated with a task, a resource or an assignment.
public ElementType ElementType { get; set; }
Property Value
FieldId
Gets or sets corresponds to the project id of a custom field. Use string representation of a constant from Aspose.Tasks.ExtendedAttributeTask class to specify Aspose.Tasks.ExtendedAttributeDefinition.FieldId property.
public string FieldId { get; set; }
Property Value
Examples
customFieldDefinition.FieldId = Aspose.Tasks.ExtendedAttributeTask.Number10.ToString("D");
Remarks
Preferable way to set Aspose.Tasks.ExtendedAttributeDefinition.FieldId property is to create Aspose.Tasks.ExtendedAttributeDefinition using one of the dedicated factory methods like Aspose.Tasks.ExtendedAttributeDefinition.CreateTaskDefinition(Aspose.Tasks.ExtendedAttributeTask,System.String) or Aspose.Tasks.ExtendedAttributeDefinition.CreateLookupTaskDefinition(Aspose.Tasks.CustomFieldType,Aspose.Tasks.ExtendedAttributeTask,System.String).
FieldName
Gets the name of a custom field.
public string FieldName { get; }
Property Value
Remarks
Should not be set directly, instead create ExtendedAttributeDefinition using strongly typed static factory methods named like Create*Definition().
Formula
Gets or sets the formula that Microsoft Project uses to populate a custom task field.
public string Formula { get; set; }
Property Value
GraphicalIndicator
Gets or sets a graphical indicators info associated with the extended attribute. Applicable to MPP format.
public GraphicalIndicatorsInfo GraphicalIndicator { get; set; }
Property Value
Guid
Gets or sets the Guid of a custom field.
public string Guid { get; set; }
Property Value
Remarks
Currently supported for Xml format only.
LookupUid
Gets a Guid of the lookup table associated with a custom field.
public string LookupUid { get; }
Property Value
Remarks
In order to create a custom field with lookup, use one of the factory methods: Aspose.Tasks.ExtendedAttributeDefinition.CreateLookupTaskDefinition(Aspose.Tasks.CustomFieldType,Aspose.Tasks.ExtendedAttributeTask,System.String) or Aspose.Tasks.ExtendedAttributeDefinition.CreateLookupResourceDefinition(Aspose.Tasks.CustomFieldType,Aspose.Tasks.ExtendedAttributeResource,System.String).
MaxMultiValues
Gets or sets the maximum number of values you can set in a pick list.
public int MaxMultiValues { get; set; }
Property Value
Remarks
Currently supported for Xml format only.
ParentProject
Gets the parent project for the Aspose.Tasks.ExtendedAttributeDefinition instance.
public Project ParentProject { get; }
Property Value
PhoneticsAlias
Gets or sets the phonetic pronunciation of the alias of a custom field.
public string PhoneticsAlias { get; set; }
Property Value
Remarks
Currently supported for Xml format only.
RestrictValues
Gets or sets a value indicating whether the custom field values are restricted to values in the Aspose.Tasks.ExtendedAttributeDefinition.ValueList.
public bool RestrictValues { get; set; }
Property Value
RollupType
Gets or sets the way rollups are calculated.
public RollupType RollupType { get; set; }
Property Value
Remarks
Writing currently supported for Xml format only.
SecondaryGuid
Gets or sets the secondary guid of extended attribute.
public string SecondaryGuid { get; set; }
Property Value
Remarks
This is new for MS Project 2010 property.
SecondaryPid
Gets or sets the secondary PID of a custom field.
public string SecondaryPid { get; set; }
Property Value
SummaryRowsCalculationType
Gets or sets the type of calculation of the custom attribute’s value for summary rows.
public SummaryRowsCalculationType SummaryRowsCalculationType { get; set; }
Property Value
UserDef
Gets or sets a value indicating whether a custom field is user defined.
public bool UserDef { get; set; }
Property Value
Remarks
Currently supported for Xml format only.
ValueList
Gets the List<Value> ValueList.
public List<value> ValueList { get; }
Property Value
Remarks
When values of extended attributes are specified as properties of elements in the schema, they may either be specified by values or by references to the values contained in this list. Applications may assume ordering of the list by ordering specified here. Currently supported for MSP 2003/2007 Xml and MSP 2003 mpp formats. Do not change this list directly. Use ExtendedAttributeDefinition.AddLookupValue/RemoveLookupValue methods instead.
ValuelistSortOrder
Gets or sets the way value lists are sorted. Values are: 0=Descending, 1=Ascending.
public int ValuelistSortOrder { get; set; }
Property Value
Remarks
Currently supported for MSP 2003/2007 Xml and MSP 2003 mpp formats.
Methods
AddLookupValue(Value)
Adds a value to the internal lookup list. This is a preferable way for manipulations with the Aspose.Tasks.ExtendedAttributeDefinition.ValueList.
public void AddLookupValue(Value value)
Parameters
value
Value
Value to add into lookup.
Examples
Use this code to add new Value to lookup list:
taskTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
Remarks
This method works only for Aspose.Tasks.ExtendedAttributeDefinition instances which have Aspose.Tasks.ExtendedAttributeDefinition.CalculationType equals to Aspose.Tasks.CalculationType.Lookup.
CreateExtendedAttribute()
Creates a new extended attribute with the field ID which equals to this object’s field ID value.
public ExtendedAttribute CreateExtendedAttribute()
Returns
returns created instance of the Aspose.Tasks.ExtendedAttribute class with the fieldID which equals to this object’s fieldID value.
CreateExtendedAttribute(string)
Creates a new extended attribute with the field ID which equals to this object’s field ID value and the specified text value.
public ExtendedAttribute CreateExtendedAttribute(string textValue)
Parameters
textValue
string
The specified text value.
Returns
returns created instance of the Aspose.Tasks.ExtendedAttribute class with the fieldID which equals to this object’s fieldID value.
Exceptions
If current Aspose.Tasks.ExtendedAttributeDefinition.CfType is not ‘Text’
CreateExtendedAttribute(decimal)
Creates a new extended attribute with the field ID which equals to this object’s field ID value and the specified numeric value.
public ExtendedAttribute CreateExtendedAttribute(decimal numericValue)
Parameters
numericValue
decimal
The specified numeric value.
Returns
returns created instance of the Aspose.Tasks.ExtendedAttribute class with the fieldID which equals to this object’s fieldID value.
Exceptions
If current Aspose.Tasks.ExtendedAttributeDefinition.CfType is not ‘Number’ or ‘Cost’
CreateExtendedAttribute(DateTime)
Creates a new extended attribute with the field ID which equals to this object’s field ID value and the specified date value.
public ExtendedAttribute CreateExtendedAttribute(DateTime dateTimeValue)
Parameters
dateTimeValue
DateTime
The specified date time value.
Returns
returns created instance of the Aspose.Tasks.ExtendedAttribute class with the fieldID which equals to this object’s fieldID value.
Exceptions
If current Aspose.Tasks.ExtendedAttributeDefinition.CfType is not ‘Date’, ‘Start’ or ‘Finish’
CreateExtendedAttribute(Duration)
Creates a new extended attribute with the field ID which equals to this object’s field ID value and the specified duration value.
public ExtendedAttribute CreateExtendedAttribute(Duration durationValue)
Parameters
durationValue
Duration
The specified duration value.
Returns
returns created instance of the Aspose.Tasks.ExtendedAttribute class with the fieldID which equals to this object’s fieldID value.
Exceptions
If current Aspose.Tasks.ExtendedAttributeDefinition.CfType is not ‘Duration’
CreateExtendedAttribute(bool)
Creates a new extended attribute with the field ID which equals to this object’s field ID value and the specified flag value.
public ExtendedAttribute CreateExtendedAttribute(bool flagValue)
Parameters
flagValue
bool
The specified flag value.
Returns
returns created instance of the Aspose.Tasks.ExtendedAttribute class with the fieldID which equals to this object’s fieldID value.
Exceptions
If current Aspose.Tasks.ExtendedAttributeDefinition.CfType is not ‘Flag’
CreateExtendedAttribute(Value)
Creates new extended attribute linked with specified Aspose.Tasks.Value item.
public ExtendedAttribute CreateExtendedAttribute(Value lookupValue)
Parameters
lookupValue
Value
The specified Aspose.Tasks.Value item.
Returns
returns created instance of the Aspose.Tasks.ExtendedAttribute class linked with specified Aspose.Tasks.Value item.
Examples
Use this code to create new Aspose.Tasks.ExtendedAttribute using specific value:
csharp
taskTextAttr.AddLookupValue(value1);
taskTextAttr.AddLookupValue(value2);
var extendedAttribute = taskTextAttr.CreateExtendedAttribute(value2);
Remarks
lookupValue
should be previously added to the Aspose.Tasks.ExtendedAttributeDefinition using Aspose.Tasks.ExtendedAttributeDefinition.AddLookupValue(Aspose.Tasks.Value) method.
CreateLookupResourceDefinition(ExtendedAttributeResource, string)
Factory method which creates an extended attribute definition with lookup.
It has Aspose.Tasks.ExtendedAttributeDefinition.CalculationType equals to Aspose.Tasks.CalculationType.Lookup and can be used in Resources only.
You are required to specify fieldId
and alias
when call this method.
The field type is inferred from field id.
public static ExtendedAttributeDefinition CreateLookupResourceDefinition(ExtendedAttributeResource fieldId, string alias)
Parameters
fieldId
ExtendedAttributeResource
The specified Aspose.Tasks.ExtendedAttributeResource field ID.
alias
string
The specified System.String alias.
Returns
Created instance of the Aspose.Tasks.ExtendedAttributeDefinition class with specified fieldId
and alias
.
Examples
Use this example to create a custom field definition for a resource with lookup and then fill it with text values:
csharp
var resourceTextAttr = ExtendedAttributeDefinition.CreateLookupResourceDefinition(ExtendedAttributeResource.Text27, "My custom field");
resourceTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
resourceTextAttr.AddLookupValue(new Value { Id = 2, Val = "Text value 2", Description = "Text value description 2" });
project.ExtendedAttributes.Add(resourceTextAttr);
CreateLookupResourceDefinition(CustomFieldType, ExtendedAttributeResource, string)
Factory method which creates an extended attribute definition with lookup.
It has Aspose.Tasks.ExtendedAttributeDefinition.CalculationType equals to Aspose.Tasks.CalculationType.Lookup and can be used in Resources only.
You are required to specify customFieldType
, fieldId
and alias
when call this method.
public static ExtendedAttributeDefinition CreateLookupResourceDefinition(CustomFieldType customFieldType, ExtendedAttributeResource fieldId, string alias)
Parameters
customFieldType
CustomFieldType
The specified Aspose.Tasks.CustomFieldType type.
fieldId
ExtendedAttributeResource
The specified Aspose.Tasks.ExtendedAttributeResource field ID.
alias
string
The specified System.String alias.
Returns
Created instance of the Aspose.Tasks.ExtendedAttributeDefinition class with specified customFieldType
, fieldId
and alias
.
Examples
Use this example to create a custom field definition for a resource with lookup and then fill it with text values:
csharp
var resourceTextAttr = ExtendedAttributeDefinition.CreateLookupResourceDefinition(CustomFieldType.Text, ExtendedAttributeResource.Text27, "My custom field");
resourceTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
resourceTextAttr.AddLookupValue(new Value { Id = 2, Val = "Text value 2", Description = "Text value description 2" });
project.ExtendedAttributes.Add(resourceTextAttr);
CreateLookupTaskDefinition(ExtendedAttributeTask, string)
Factory method which creates an extended attribute definition with lookup.
It has Aspose.Tasks.ExtendedAttributeDefinition.CalculationType equals to Aspose.Tasks.CalculationType.Lookup and can be used in Tasks only.
You are required to specify fieldId
and alias
when call this method.
The field type is inferred from field id.
public static ExtendedAttributeDefinition CreateLookupTaskDefinition(ExtendedAttributeTask fieldId, string alias)
Parameters
fieldId
ExtendedAttributeTask
The specified Aspose.Tasks.ExtendedAttributeTask field ID.
alias
string
The specified System.String alias.
Returns
Created instance of the Aspose.Tasks.ExtendedAttributeDefinition class with specified fieldId
and alias
.
Examples
Use this example to create a custom field definition for a task with lookup and then fill it with text values:
csharp
var taskTextAttr = ExtendedAttributeDefinition.CreateLookupTaskDefinition(ExtendedAttributeTask.Text27, "My custom field");
taskTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
taskTextAttr.AddLookupValue(new Value { Id = 2, Val = "Text value 2", Description = "Text value description 2" });
project.ExtendedAttributes.Add(taskTextAttr);
CreateLookupTaskDefinition(CustomFieldType, ExtendedAttributeTask, string)
Factory method which creates an extended attribute definition with lookup.
It has Aspose.Tasks.ExtendedAttributeDefinition.CalculationType equals to Aspose.Tasks.CalculationType.Lookup and can be used in Tasks only.
You are required to specify customFieldType
, fieldId
and alias
when call this method.
public static ExtendedAttributeDefinition CreateLookupTaskDefinition(CustomFieldType customFieldType, ExtendedAttributeTask fieldId, string alias)
Parameters
customFieldType
CustomFieldType
The specified Aspose.Tasks.CustomFieldType type.
fieldId
ExtendedAttributeTask
The specified Aspose.Tasks.ExtendedAttributeTask field ID.
alias
string
The specified System.String alias.
Returns
Created instance of the Aspose.Tasks.ExtendedAttributeDefinition class with specified customFieldType
, fieldId
and alias
.
Examples
Use this example to create a custom field definition for a task with lookup and then fill it with text values:
csharp
var taskTextAttr = ExtendedAttributeDefinition.CreateLookupTaskDefinition(CustomFieldType.Text, ExtendedAttributeTask.Text27, "My custom field");
taskTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
taskTextAttr.AddLookupValue(new Value { Id = 2, Val = "Text value 2", Description = "Text value description 2" });
project.ExtendedAttributes.Add(taskTextAttr);
CreateResourceDefinition(CustomFieldType, ExtendedAttributeResource, string)
Factory method which creates a simple extended attribute definition, which Microsoft Project shows as “None”.
It has Aspose.Tasks.ExtendedAttributeDefinition.CalculationType equals to Aspose.Tasks.CalculationType.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)
Parameters
customFieldType
CustomFieldType
The specified Aspose.Tasks.CustomFieldType type.
fieldId
ExtendedAttributeResource
The specified Aspose.Tasks.ExtendedAttributeResource field ID.
alias
string
The specified System.String alias.
Returns
Created instance of the Aspose.Tasks.ExtendedAttributeDefinition class with specified customFieldType
, fieldId
and alias
.
Examples
Use this example to create a custom text field definition:
csharp
var resourceTextAttr = ExtendedAttributeDefinition.CreateResourceDefinition(CustomFieldType.Text, ExtendedAttributeResource.Text27, "My custom field");
project.ExtendedAttributes.Add(resourceTextAttr);
CreateResourceDefinition(ExtendedAttributeResource, string)
Factory method which creates a simple extended attribute definition, which Microsoft Project shows as “None”.
It has Aspose.Tasks.ExtendedAttributeDefinition.CalculationType equals to Aspose.Tasks.CalculationType.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)
Parameters
fieldId
ExtendedAttributeResource
The specified Aspose.Tasks.ExtendedAttributeResource field ID.
alias
string
The specified System.String alias.
Returns
Created instance of the Aspose.Tasks.ExtendedAttributeDefinition class with specified fieldId
and alias
.
Examples
Use this example to create a custom text field definition:
csharp
var resourceTextAttr = ExtendedAttributeDefinition.CreateResourceDefinition(ExtendedAttributeResource.Text27, "My custom field");
project.ExtendedAttributes.Add(resourceTextAttr);
CreateTaskDefinition(CustomFieldType, ExtendedAttributeTask, string)
Factory method which creates a simple extended attribute definition, which Microsoft Project shows as “None”.
It has Aspose.Tasks.ExtendedAttributeDefinition.CalculationType equals to Aspose.Tasks.CalculationType.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)
Parameters
customFieldType
CustomFieldType
The specified Aspose.Tasks.CustomFieldType type.
fieldId
ExtendedAttributeTask
The specified Aspose.Tasks.ExtendedAttributeTask field ID.
alias
string
The specified System.String alias.
Returns
Created instance of the Aspose.Tasks.ExtendedAttributeDefinition class with specified customFieldType
, fieldId
and alias
.
Examples
Use this example to create a custom text field definition:
csharp
var taskTextAttr = ExtendedAttributeDefinition.CreateTaskDefinition(CustomFieldType.Text, ExtendedAttributeTask.Text27, "My custom field");
project.ExtendedAttributes.Add(taskTextAttr);
CreateTaskDefinition(ExtendedAttributeTask, string)
Factory method which creates a simple extended attribute definition, which Microsoft Project shows as “None”.
It has Aspose.Tasks.ExtendedAttributeDefinition.CalculationType equals to Aspose.Tasks.CalculationType.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)
Parameters
fieldId
ExtendedAttributeTask
The specified Aspose.Tasks.ExtendedAttributeTask field ID.
alias
string
The specified System.String alias.
Returns
Created instance of the Aspose.Tasks.ExtendedAttributeDefinition class with specified fieldId
and alias
.
Examples
Use this example to create a custom text field definition:
csharp
var taskTextAttr = ExtendedAttributeDefinition.CreateTaskDefinition(ExtendedAttributeTask.Text27, "My custom field");
project.ExtendedAttributes.Add(taskTextAttr);
Equals(object)
Returns a flag indicating whether this instance is equal to the specified object.
public override bool Equals(object obj)
Parameters
obj
object
the specified object to compare to this instance.
Returns
a flag indicating whether this instance is equal to the specified object.
GetHashCode()
Returns a hash code for the instance of the Aspose.Tasks.ExtendedAttributeDefinition class.
public override int GetHashCode()
Returns
a hash code for this object.
RemoveLookupValue(Value)
Removes a value from the internal lookup list. This is a preferable way for manipulations with the Aspose.Tasks.ExtendedAttributeDefinition.ValueList.
public void RemoveLookupValue(Value value)
Parameters
value
Value
Value to remove from lookup.
Remarks
This method works only for Aspose.Tasks.ExtendedAttributeDefinition instances which have Aspose.Tasks.ExtendedAttributeDefinition.CalculationType equals to Aspose.Tasks.CalculationType.Lookup.