Welcome to MSDN Blogs Sign in | Join | Help

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)
            {
                Console.WriteLine(header.Name);
            }
        }
    }
}

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.

Published Friday, February 24, 2006 8:25 AM by buckh
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# VSTS Links - 02/27/2006

Rob Caron blogs about the Team System Friday Morning Briefings.  He also talks about Project Server and...
Monday, February 27, 2006 10:06 AM by Team System News

# Links to code samples

I recently had to put together a list of links to code samples.&amp;nbsp; This isn't even close to comprehensive,...
Saturday, August 12, 2006 10:54 AM by Buck Hodges

# Los servicios del modelo de objetos de Team Foundation Server

La arquitectura de Team Foundation esta orientada a servicios, no en el sentido que utiliza servicios
Thursday, September 07, 2006 6:14 AM by ASP.NET Espanol Blogs

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker