Connecting to a Team Foundation Server

March 17, 2006

You can use the following code to connect to a Team Foundation Server using the built in Connect dialog and User Authentication dialog.

using Microsoft.TeamFoundation.Proxy;

DomainProjectPicker domainProjectPicker =
             
new DomainProjectPicker(DomainProjectPickerMode.None); 

//Options for DomainProjectPickerMode
// DomainProjectPickerMode.AllowMultiSelect;
// DomainProjectPickerMode.AllowProjectSelect;
// DomainProjectPickerMode.DisableServerSelect;
// DomainProjectPickerMode.ForwardWndMsgOutsideVS;
// DomainProjectPickerMode.None;

TeamFoundationServer tfs;
if
(domainProjectPicker.ShowDialog() == DialogResult.OK)
{
  tfs= domainProjectPicker.SelectedServer;
  tfs.EnsureAuthenticated(
new UICredentialsProvider());
}
 
    

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

%d bloggers like this: