How to Get Your Entire Work Item History in TFS
The more I use TFS at work the more I like it. However, with large development teams the sheer number of work items that are created over time can be staggering and searching through them to find a particular work item you are interested in can be extremely tedious.
Today I ran into an issue where I needed to track down some information on a work item I completed several months ago and had since been assigned to someone in our test group. Tracking down this particular work item outside of TFS would have been a small nightmare so I decided to try and come up with a query that would pull back every single work item I have ever been associated with.
The query to do this is actually pretty simple and requires two conditions:
- History Contains @Me
- Or Assigned To = @Me
History Contains @Me will pull back every work item that you have ever interacted with whether you associated a changeset with it, assigned it to someone else, or simply closed the work item because it was a duplicate. This condition alone is very powerful and will give you a complete history of every work item you have ever worked on.
The Assigned To = @Me condition is gravy at this point. This will allow you to catch all of the work items that are assigned to you that you haven't worked on yet (and thus, built no history in).
You can add some additional coolness to your query by sorting by specific column types. This will allow you to scan through your work items more efficiently.
I prefer the following columns to be sorted (in this order)
- State - Ordering by State first will keep all of your Active work items at the top of the list.
- Next Action - This will keep all of your Queued and Coding work items together.
- ID - This will keep the newer work items above the older ones.
Finally, adding a few extra columns to your query will help give you the bigger-picture context for each work item without forcing you to open it.
Here is what I use, your mileage may vary depending on your development workflow.
By adding this superset query in TFS you will be able to obtain a more complete picture of all of your past work items whether or not they are still assigned to you. This makes things especially handy for when you are trying to hunt down details for work you completed months or years in the past.