Paul Hacker .Net, TFS, Etc…

November 22, 2010

Free MS e-Books

Filed under: Team System — phacker @ 11:43 am

Here are some free e-books from MS Press.

Free Microsoft Press eBooks Available for Download

Enjoy free offerings from Microsoft Press! Here’s an updated list of some of their free eBooks:

Free eBook: Moving to Microsoft Visual Studio 2010 (10 chapters by Patrice Pelland, Pascal Paré, and Ken Haines)
Free eBook: Introducing Microsoft SQL Server 2008 R2 (10 chapters by Ross Mistry and Stacia Misner)

Free eBook: Programming Windows Phone 7 Series (DRAFT Preview) (6 chapters by Charles Petzold)

Free eBook: Petzold’s Programming Windows Phone 7 (Special Excerpt 2) (newer than the eBook above; 11 chapters by Charles Petzold)

Free eBook: Own Your Future: Update Your Skills with Resources and Career Ideas from Microsoft (8 chapters by Katherine Murray)

Free eBook: Understanding Microsoft Virtualization Solutions (Second Edition) (6 chapters by Mitch Tulloch)

Free eBook: First Look Microsoft Office 2010 (14 chapters by Katherine Murray)

Free eBook: Windows 7 troubleshooting tips (short eBook by Mitch Tulloch)

Free eBook: Introducing Windows Server 2008 R2 (9 chapters by Charlie Russel and Craig Zacker)

Free eBook: Deploying Windows 7, Essential Guidance (10 chapters from the Windows 7 Resource Kit and 6 TechNet articles)


November 5, 2010

List all TFS Project Collections and Projects

Filed under: Team System — phacker @ 1:39 pm

I recently had a request to list all project collections and the projects that are in the collections Here is what I came up with to do the trick. Maybe it will help someone else. I used the following website to help me out

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Framework.Client;
using System.Collections.ObjectModel;
using System.Net;
using Microsoft.TeamFoundation.Framework.Common;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace TFS2010ProjectList
class Program
// without collection name
public static string url = @”http://tfsserverurl:8080/tfs”;

static void Main(string[] args)

private static void GetProjects()
TfsConfigurationServer srv = GetTfsConfigurationServer();
if (EnsureAuthentication(srv))
CatalogNode configurationServerNode = srv.CatalogNode;
// Query the children of the configuration server node for all of the team project collection nodes
ReadOnlyCollection tpcNodes = configurationServerNode.QueryChildren(
new Guid[] { CatalogResourceTypes.ProjectCollection }, false, CatalogQueryOptions.None);

foreach (CatalogNode tpcNode in tpcNodes)
Guid tpcId = new Guid(tpcNode.Resource.Properties[“InstanceId”]);
TfsTeamProjectCollection tpc = srv.GetTeamProjectCollection(tpcId);
//Console.WriteLine(“{0}”, tpc.Name);

var workItemStore = tpc.GetService();

// go over the next node if no projects available
if (workItemStore.Projects.Count <= 0)
// iterate over the projects
foreach (Project project in workItemStore.Projects)
Console.WriteLine("\tProject: {0}", project.Name);



public static TfsConfigurationServer GetTfsConfigurationServer()
return new TfsConfigurationServer(new Uri(url), GetCredentials(), new UICredentialsProvider());
} [System.Diagnostics.DebuggerStepThrough]

private static ICredentials GetCredentials()
return new NetworkCredential("username", "password", "Domain");
public static bool EnsureAuthentication(TfsConfigurationServer srv)
bool result = true; try
result = srv.HasAuthenticated;
catch (Exception)
result = false;

return result;

Create a free website or blog at