Listing the process templates on a TFS server

In response to a forum question about how to list the process templates on the server, Tony Edwards, a developer on Work Item Tracking, posted the following code snippet showing how to do it.  The TeamFoundationServer object provides a number of services, including one for dealing with process templates.

Here is  a simple console program to list the templates.  IProcessTemplate has members that return XML – you could bind that to the grid.  You would invoke the sample below as follows:

templateheaders http://<your_server>:8080

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.TeamFoundation.Server;
using Microsoft.TeamFoundation.Client;

namespace TemplateHeaders
    class Program
        static void Main(string[] args)
            TeamFoundationServer tfs = new TeamFoundationServer(args[0]);
            IProcessTemplates templates =
                (IProcessTemplates) tfs.GetService(typeof(IProcessTemplates));
            TemplateHeader [] headers = templates.TemplateHeaders();
            foreach (TemplateHeader header in headers)

If you haven’t built a code sample before, you can find instructions on adding the TFS assemblies to the .NET tab in VS here.

Comments (3)

  1. Rob Caron blogs about the Team System Friday Morning Briefings.  He also talks about Project Server and…

  2. Buck Hodges says:

    I recently had to put together a list of links to code samples.&amp;nbsp; This isn’t even close to comprehensive,…

  3. La arquitectura de Team Foundation esta orientada a servicios, no en el sentido que utiliza servicios