Geeks With Blogs
TFS Austin Agile SCM Talk Visual Studio ALM Team Foundation Server Practice

I found a lot of code to do these things, but really appreciated a more concise and simple approach. For example, this can be run as a unit test.

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Xml;
using System.Collections.Generic;
using System.Linq;
using Microsoft.TeamFoundation.Server;
using Microsoft.TeamFoundation.Common;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using Microsoft.TeamFoundation.Framework.Client;
using Microsoft.TeamFoundation.Framework.Common;
        public void ImportProcessTemplateWitDefinitionsToCollection()
            string wsPath = @"{your path}\WorkItem Tracking\TypeDefinitions\";
            List<string> wits = new List<string>();

            TfsTeamProjectCollection tpc = 
                new TfsTeamProjectCollection(new Uri("{your collection url}"))
            var wis = new WorkItemStore(tpc);
            var projects = (from Project p in wis.Projects select p.Name).ToList();

            foreach (var targetTfsProjectName in projects)
                foreach (string wit in wits)
                    XmlDocument WitDefFile = new XmlDocument();
                    WitDefFile.Load(wsPath + wit);
                    string WitDef = WitDefFile.InnerXml;
Posted on Friday, December 14, 2012 9:58 AM | Back to top

Comments on this post: Simple TFS 2012 API Methods: List Projects in a Collection and Import WIT Definitions

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Bob Hardister | Powered by: | Join free