Question

Is there a way to programmatically modify a work item type on a TFS server?

The background on this is that we use a custom field similar to VSTS.Build.FoundIn and would like to have it populated with build numbers from a global list. For a single project it is not a problem - it's enough to manually specify the SUGGESTEDVALUES rule with the name of the global list. The problem with this approach is that it cannot be applied to a template that we reuse across multiple projects - there is no way to specify a placeholder for the project name in the global list reference. Hence, every time we create a TFS project we need to manually modify the global list name, like from <GLOBALLIST name="Builds - [ProjectName]" /> to <GLOBALLIST name="Builds - Project1" />

It seems that TFS has a hardcoded mechanism for creating these rules for the FoundIn and IntegrationBuild properties (see this answer) and I was considering creating a handler for a TFS event to mimic this logic for our custom fields as well.

Was it helpful?

Solution

You could subscribe to ProjectCreatedEvent on the team foundation server and then use Shai Raig's post for working with global lists to create your global list after the project is created.

http://blogs.microsoft.co.il/blogs/shair/archive/2010/03/08/tfs-api-part-23-create-global-list-xml-way.aspx

Martin Hinshelwood has a good post on subscribing to server events here: http://blog.hinshelwood.com/archive/2010/09/16/team-foundation-server-2010-event-handling-with-subscribers.aspx

EDIT: You can use the Team Foundation Server Power Tools to edit work items, and also to modify the Project Templates so that work items will have the new field.

UPDATE 1/20/2011: I found this question which answers how to import and export work items: TFS Client APIs for creating workitem templates?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top