Share via


Connect with Team Project using DomainProjectPicker dialog control

One of the most common public controls provided by TFS API’s is the DomainProjectPicker within the namespace Microsoft.TeamFoundation.Proxy. This dialog class allows the user to select the team project to connect to. Code snippet for using this control is as follows,

DomainProjectPicker dpp = new DomainProjectPicker(DomainProjectPickerMode.None);

if (dpp.ShowDialog() == DialogResult.OK)

{

    try

    {

        Cursor.Current = Cursors.WaitCursor;

        tfsServer = new TeamFoundationServer(dpp.SelectedServer.Name, new UICredentialsProvider());

        tfsServer.Authenticate();

        //Connect to VersionControlServer, BuildStore or WorkItemStore.

    }

    catch (Exception ex)

    {

        //Exception handling

    }

    finally

    {

        Cursor.Current = Cursors.Default;

    }

}

Comments