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

by Ewald Hofman 3. December 2009 03: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 
tfai.EnsureAuthenticated(); 

// 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.

Tags:

VSTS 2010 | TFS SDK

Comments

2/18/2010 4:51:52 PM #

pingback

Pingback from zianet.dk

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

zianet.dk | Reply

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

 

Ewald Hofman is MVP VS ALM and consultant at Avanade. His specialization is Application Lifecycle Management solutions based on Visual Studio ALM.

 

 

ClusterMap

Statistics

Statistics created at 09 Sep 2009

72 posts
43 comments
27 raters
24810 visit (135 per day)
8 users online