• RyanDev.com

  • Use Microsoft SRS To Automatically Send Open Tasks To TFS Users

25th March 2009

Use Microsoft SRS To Automatically Send Open Tasks To TFS Users

I have already posted the SQL code you can use to get a list of all open work items across all projects within Team Foundation Server 2008 (TFS).  Now I will walk you through one way to create a SQL Reporting Services Report using Microsoft SQL Server 2005’s SQL Server Business Intelligence Development Studio.  Then we will see how to schedule it.  Note: We will not cover how to configure SRS.  This is assuming that SRS is already setup with email settings.

This sample was created directly on the Microsoft Team Foundation Server.

1. Open SQL Server Business Intelligence Development Studio

tfsreport1.jpg

2. Click Create Project.  There are several ways to create the report and in this example choose the template named Report Server Project Wizard.  Provide a name of TFSItems and save the project anywhere.

tfsreport2.jpg

3. The Welcome to the Report Wizard screen is displayed.  Click Next.

tfsreport3.jpg

4. Create a new data source and name it dsTFSItems.  Click Next.

tfsreport4.jpg

5. Click Edit and provide connection information to your SQL server.  Set the database to TfsWorkItemTracking.  Click OK.

tfsreport5.jpg

6. The data source connection string is now filled in. Click Next.

tfsreport6.jpg

7. Copy and paste the SQL statement from my earlier post.  Note: you will probably have to correct the single quote characters because they will probably not paste accurately and you will get syntax errors when clicking on Next.  Click Next.

tfsreport7.jpg

8. Select the Tabular report type and click Next.

tfsreport8.jpg

9.  Move all of the fields into the Details section.  Click Next.

tfsreport9.jpg

10. Choose a table style.  In this case, I chose Slate.  Click Next.

tfsreport10.jpg

11. Make sure the report server field is correct.  Leave the deployment folder with the default value.  Click Next.

tfsreport11.jpg

12. The final screen of the wizard is displayed showing a summary of what the wizard will do.  Click Finish.

tfsreport12.jpg

13. You now have a TFS report in Visual Studio.

tfsreport13.jpg

14. We want to be able to select a specific person and see just the tasks that are assigned to them.  To do that we need to have a second dataset.  Click on the Data tab and then under Dataset choose <New Dataset…>

tfsreport14.jpg

15. Name the dataset dsAssignedTo and paste the following SQL into the Query String field.  Note: You may have to adjust the single quotes after pasting.

SELECT Person, Email FROM TFSWarehouse.dbo.Person WHERE Email IS NOT NULL AND EMAIL <> ” AND EMAIL LIKE ‘%@%’ ORDER BY Person

tfsreport15.jpg

16. Now we need to add a report parameter.  To do so, click on Report, Report Parameters in the menu.

tfsreport16.jpg

17. Create a report parameter named AssignedTo and select from the dsAssignedTodataset as shown below.

tfsreport17.jpg

18. Now we need to use this report parameter in our main dataset.  Select the dsTFSItemsdataset and add one more WHERE clause: “AND w1.[Assigned To] IN (@AssignedTo)”

tfsreport18.jpg

19. The report is done.  We now need to deploy it to the SRS server.  To do so, right click on the project name in the Solution Explorer and choose Deploy

tfsreport19.jpg

20. Likely near the bottom of your screen will be the Output window and it should indicate the deployment was successful.

tfsreport20.jpg

21. Now, open Internet Explorer and browse to the report server at http://localhost/Reports.  You will notice a folder named TFSItems which was created when we did the deploy. 

tfsreport21.jpg

22. Open the TFSItems report folder and you will see the report we created, TFSDailyItems.

tfsreport22.jpg

23. Click on the report and you will see that we have a drop down list of various people in TFS. 

tfsreport23.jpg

24. Select a name and then click on View Report and you will see their open items.

tfsreport24.jpg

25. To schedule this report, click on the New Subscription button.  Fill out who you want the report sent to and how often.  Then select their name from the AssignedTo report parameter.

tfsreport25.jpg

26. To see which subscriptions have been setup, click on the Subscriptions tab of the report.

tfsreport26.jpg

That’s it.  Now every day at the time you specified an email will be sent with their open TFS items from all projects.

posted in General Software Development, Microsoft .Net | 4 Comments

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.

posted in General Software Development, Microsoft .Net | 5 Comments

  • Links

  • Calendar

  • March 2009
    S M T W T F S
    « Dec   Apr »
    1234567
    891011121314
    15161718192021
    22232425262728
    293031