In Python, setting task Extended Attribute

Is there a way in python to set an extended attribute? I have the attribute set to TEXT1, but I cannot add it to the task ExtendedAttributes list.

#set the Definitions
Eq = tsk.ExtendedAttributeDefinition.create_task_definition(tsk.CustomFieldType.TEXT, tsk.ExtendedAttributeTask.TEXT1, ‘Equip’)
#create the project
proj = tsk.Project()
#add them to the project
proj.extended_attributes.append(EquipAttribute)
#region Set extended attribute value for task
tr = tsk.ExtendedAttribute
tr.create_extended_attribute(Eq)
tr.text_value = ‘something’

@johnWeeksGrp,
the following snippet could be used to add attribute value to the task:

#set the Definition
Eq = tsk.ExtendedAttributeDefinition.create_task_definition(tsk.CustomFieldType.TEXT, tsk.ExtendedAttributeTask.TEXT1, 'Equip')
#create the project
proj = tsk.Project()
#add definition to the project
proj.extended_attributes.append(Eq)
# create extended attribute value
eaValue = Eq.create_extended_attribute('something')

#create task
task: tsk.Task = proj.root_task.children.add("task 1")
# Set extended attribute value for task
task.extended_attributes.append(eaValue)
1 Like

Thank you Vasiliy, worked perfectly.

1 Like