Connect to Team Foundation Server 2012 via C#

Team foundation server is a great tool for managing projects.  However, sometimes working through the UI just isn’t efficient enough for large operations.  However, with new tooling comes the concern of how to port over all those work items from an older technology.  In the next few posts, I’ll be be showing some code to connect to TFS 2012, to add areas to the scrum template, and import information in the product backlog. It’s not complicated, but often time coming across the information in a single source is hard to do.

var projectCollection = new TfsTeamProjectCollection(
    new Uri("http://myserver:8080/tfs/DefaultCollection"), 
    new NetworkCredential("youruser", "yourpassword"));

projectCollection.Connect(ConnectOptions.IncludeServices);

At this point you’ll have a connection to TFS ready to go!  In the next posts, we’ll use the GetServices<> method on the projectCollection variable to retrieve specific services in order to make changes to the project collection.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s