Monday, April 11, 2011

TFS Client API - Query to get work items linked to a specific file?

We are writing a custom tool using TFS client APIs, to connect to TFS, to fetch work items for a project etc.


We are querying the work item store, using WIQL.

Given the server path of a file, what is the easiest query to get the work items linked to this file from TFS?

From stackoverflow
  • Right-click the file in Solution Explorer and select View History. You will get a list of changesets. Double-clicking a changeset will bring up a dialog where you can see related work items.

    amazedsaint : Sorry, I'm talking about using WIQL to query the TFS from a custom tool we are developing.
  • I'm not sure that there is an easy way to do the query that you are requesting using the TFS API. I know that you definately cannot do it using WIQL. I think, using the API, you would have to iterate over all the work items - get the changeset links in them and then look in each changeset for the file path that you are after. This is obviously not much use.

    You could get that data using the TFS Data Warehouse database however. This information will lag behind the live operational store information because the warehouse only gets updated periodically - but will allow you to track things by the folder/file dimension pretty easily.

0 comments:

Post a Comment