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

by Ewald Hofman 3. December 2009 20: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/19/2010 9:51:52 AM #

pingback

Pingback from zianet.dk

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

zianet.dk | Reply

4/8/2010 6:25:15 AM #

pingback

Pingback from topsy.com

Twitter Trackbacks for
        
        Ewald Hofman | TFS SDK 2010 – Part 1 – Get the Team Project Collection
        [ewaldhofman.nl]
        on Topsy.com

topsy.com | Reply

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.6.1.0
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

105 posts
129 comments
73 raters
124043 visit (345 per day)
15 users online

Recent comments

Comment RSS