Reading Scrum Teams from TFS

by: Per Bjurström

Sample code on how to get the Scrum teams for a specified Team Project in TFS using Conchango's scrum process template. Also implements caching.

public string[] GetScrumTeams(TeamFoundationServer tfs, string tfsProject)
{
  ArrayList teams = HttpRuntime.Cache["_scrum_TeamCache"] as ArrayList;
  if (teams == null)
  {
      teams = new ArrayList();
      WorkItemStore workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
      XmlDocument doc = workItemStore.ExportGlobalLists();
      XmlNode node = doc.SelectSingleNode("//GLOBALLIST[@name='Teams - " + tfsProject + "']");
      if (node == null)
          return new string[] { };
 
      foreach (XmlNode listItem in node.ChildNodes)
      {
         teams.Add(listItem.Attributes["value"].Value);
      }
 
      HttpRuntime.Cache.Add("_scrum_TeamCache", teams, null, DateTime.Now.AddHours(1), Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Default, null);
    }
    return (string[])teams.ToArray(typeof(string));
}
 
 

04 December 2007

Tags:


Comments

  1. abc
Post a comment    
User verification Image for user verification  
EPiTrace logger