Tuesday, January 22, 2008

[VSTS] Adding work item query to Excel programatically

Inspired by the forum question that asked whether it is possible to add work item query to Excel file programmatically and following the reasoning of the poster that since Project Creation Wizard (PCW) can do it we should be able to do that as well, I did a bit of research. I mean, I reflected a bit.:-)

The first problem was to find the PCW plug-ins. They all implement IProjectComponentCreator (see ppt by Marcel de Vries covering PCW plug-ins inner workings) which made it easy to find them. For instance, the WSS Portal Plugin is in the class Microsoft.VisualStudio.TeamFoundation.WssSiteCreator in Microsoft.VisualStudio.TeamFoundation.TeamExplorer.dll.

Second part was to find the way this Plug-in adds queries to Excel files –the DocumentELeadEnabler class. Just call its ELeadEnable method and query is added to the Excel file. The class is internal so you should be aware of possible future changes, but for now it works all right.

Attached zip file contains the source of the command line utility that takes several arguments (Path to the Excel file, Server name, Server url, Project name, Project uri and the work item query guid) and inserts the query in the file. Hint: The guids and urls for the project and queries can be found in the properties window in Team Explorer. Query guid is a part of the query uri.

Attached:
AddWIQLToExcel.zip

2 Comments:

Anonymous Anonymous said...

The tool sounds perfect, but the link leads to a 404 =/

Tue Mar 29, 09:08:00 PM GMT+2  
Blogger Ognjen Bajic said...

Thanks for the heads up. I've corrected the link.

Tue Mar 29, 09:23:00 PM GMT+2  

Post a Comment

<< Home