• RyanDev.com

  • Microsoft SQL Code To Get A List of Open TFS Items For All Projects

25th March 2009

Microsoft SQL Code To Get A List of Open TFS Items For All Projects

I have been playing around with a way to have Microsoft SQL Server Reporting Services (SRS) send a list of open items from Microsoft Team Foundation Server 2008 (TFS) to anyone who has open assigned TFS tasks within all projects.  The database structure is not entirely clear nor does it appear that there are stored procedures to retrieve this information.

While doing SQL traces I discovered that TFS uses in-line SQL statements and builds dynamic SQL statements instead of executing stored procedures.  As such, I have tested the SQL statement below and it appears to work correctly.  One thing I am struggling with is any project created using the eScrum template.  It does not store Areas and Iterations of Sprint Backlog Items the same way.  If you have figured it out, please post a comment, and I’ll take a look at it some more later.


SELECT w1.ID, w1.Title, w2.Iteration, w2.[Iteration Path], w1.[Work Item Type], w1.State, w3.Email
FROMWorkItemsAre w1
LEFT JOINTFSWarehouse.dbo.Iteration w2 ON w1.IterationID = w2.__ID
LEFT JOINTFSWarehouse.dbo.Person w3 ON w1.[Assigned TO] = w3.Person
WHERE 
w1.State <> ‘Done’
AND w1.State <> ‘Deleted’
AND w1.State <> ‘Deferred’
AND w1.State <> ‘Complete’
AND w1.Title IS NOT NULL
ORDER BY w2.Iteration, w1.Title


In a follow up post,  Use Microsoft SRS To Automatically Send Open Tasks To TFS Users, I describe how to create the report using Microsoft SQL Server 2005’s SQL Server Business Intelligence Development Studio and how to schedule it.

This entry was posted on Wednesday, March 25th, 2009 at 3:55 pm and is filed under General Software Development, Microsoft .Net. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

There are currently 5 responses to “Microsoft SQL Code To Get A List of Open TFS Items For All Projects”

Why not let us know what you think by adding your own comment! Your opinion is as valid as anyone elses, so come on... let us know what you think.

  1. 1 On May 31st, 2010, Yahoo News said:

    I saw this really good post today….

  2. 2 On June 2nd, 2010, News said:

    This is really good news today….

  3. 3 On July 11th, 2010, yoyo said:

    This the best article I have never seen before….

  4. 4 On October 2nd, 2010, watch said:

    Great Post!…

    […] I found your entry interesting thus I’ve added a Trackback to it on my weblog :) […]…

  5. 5 On October 3rd, 2011, asp.net, c#,javascript said:

    asp.net, c#,javascript…

    […]Microsoft SQL Code To Get A List of Open TFS Items For All Projects » RyanDev.com[…]…

Leave a Reply

  • Links

  • Calendar

  • February 2012
    S M T W T F S
    « Jan    
     1234
    567891011
    12131415161718
    19202122232425
    26272829