简体   繁体   中英

Automate Reporting TFS and Visual Studio

I have to Automate the process of creating a reports in TFS+ Visual Studio

Following are the Steps

  1. Open Data from TFS query in Excel (We have option to do so in VS 2012/2013)
  2. Format the Date Column.

I am planning to make a web application to generate reports on a button click.

If I click a button Report 1. The following 2 steps should run and report should be generated. This is my idea.

I am not sure how to start. Is there any documentation available about this? How can I programmatically open the TFS Query in Excel?

您是否看过TFS的报告功能: https : //msdn.microsoft.com/zh-cn/library/bb649552.aspx

Since you're building a report, I'm assuming that you don't need the two-way data binding that the Visual Studio export provides.

I don't necessarily think it's the best way to do it, but you could connect to TFS programmatically, retrieve the work items via the work item query, and then use an Excel library to export that data to Excel:

     TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
          new Uri("http://server:8080/tfs/DefaultCollection"));
    WorkItemStore workItemStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore));

QueryHierarchy queryRoot = workItemStore.Projects[0].QueryHierarchy;
QueryFolder folder = (QueryFolder) queryRoot["Shared Queries"];
QueryDefinition query = (QueryDefinition)folder["Active Bugs"];
queryResults = workItemStore.Query(query.QueryText);
foreach(WorkItem wi in queryResults)
{

     // Export to Excel
}

I still think you're better off exploring some of the reporting services offered in TFS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM