TFS SDK 2010 – Part 1 – Get the Team Project Collection

by Ewald Hofman 3. December 2009 11:28

This is the first post in a series that describes how you can work with the TFS Object Model, API or SDK. In this first part we will open a connection to the team project collection that opens the ability to access all artifacts of TFS.

Create a new project and add the following references to your project:

  • Microsoft.TeamFoundation.Client.dll
  • Microsoft.TeamFoundation.Common.dll

You can find the dll’s in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0

Then you have to add the following using statements:

using Microsoft.TeamFoundation.Client; 
using Microsoft.TeamFoundation.Framework.Client;

You can now open the connection with the following code:

// The url to the tfs server 
Uri tfsUri = new Uri("http://localhost:8080/tfs/");

// Load the tfs instance 
TeamFoundationApplicationInstance tfai = new TeamFoundationApplicationInstance(tfsUri, new UICredentialsProvider()); 

// Log in to TFS 

// Get the default project collection 
TeamProjectCollection tpc = tfai.GetService<ITeamProjectCollectionService>().GetDefaultCollection();

The following posts will describe how to access the rest of the artifacts (work items, version control and team build) in the TFS SDK.

All code examples are based on Beta 2 and are subject to change.




2/19/2010 12:51:52 AM #


Pingback from

Kristian Kristensen’s Blog » Connecting to the build server in TFS 2010 RC |

4/7/2010 9:25:15 PM #


Pingback from

Twitter Trackbacks for
        Ewald Hofman | TFS SDK 2010 – Part 1 – Get the Team Project Collection
        on |

Comments are closed

Powered by BlogEngine.NET
Theme by Mads Kristensen


Widget Statistics not found.

There is an error in XML document (0, 0).X

Recent comments

Comment RSS