jueves, 20 de octubre de 2011 13:40
I'm using TFS API and i would like to add field to a existing workitemtype.
I know the "manual" way with TFS power tool in VS2010. But i would like to do it by code.
With the TFS API, we can retreive a Workitemtype, modify it, and push it back into TFS.
Do we have another way to acheive this by code? Like WorkItemType.Fields.Add(My custom fields).
Todas las respuestas
lunes, 24 de octubre de 2011 7:41Moderador
Thanks for your post.
For your issue I have to say that it is possible for you to export or import one work item type programmatically by using TFS API, however, it is not possible for you to add one field to the work item type with TFS API.
Actually, all the fields are stored in the FieldDefinitions property of the WorkItemType class. The FieldDefinitions is the FieldDefinitionCollection type which consists of couples of FieldDefinition. And in order to create one new field in one work item type, you need to create one FiledDefinition first. However, all the properties in the FiledDefinition class are read-only (only have Get(), not Set()), so you can’t create one instance of FiledDefinition class. So you can not create one field programmatically.
For further information about how to export and import work item type programmatically, please refer to these following two blogs:
Vicky Song [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Marcado como respuesta acidaddict lunes, 24 de octubre de 2011 15:32
lunes, 24 de octubre de 2011 15:32
Thanks Vicky Song
I'm doing export / import right now with the API.
The API in the actual form can't add field by FieldDefinition like you said.
That's answer my question, have a nice day!