TFS API Part 3: Get Project List Using ICommonStructureService

13/01/2009

one comment

TFS API Part 3: Get Project List Using ICommonStructureService

In the first post about TFS API Part 1: Domain Picker we saw how to take TFS projects only by selecting them in the Domain Project Picker.

In the post I’ll saw how to take all project from the TFS Server.

Download Demo Project

First add reference for Microsoft.TeamFoundation,Microsoft.TeamFoundation.Client
located in – C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\

Add using for Proxy,Client and Server.

using Microsoft.TeamFoundation.Client;

using Microsoft.TeamFoundation.Proxy;

using Microsoft.TeamFoundation.Server;

Connect to TFS Server

DomainProjectPicker dp = new DomainProjectPicker(DomainProjectPickerMode.None);

dp.ShowDialog();

image

After selecting the desire TFS I’ll make TeamFoundationServer object:

  TeamFoundationServer tfs = dp.SelectedServer;

 

Create ICommonStructureService object that will take TFS Structure Service.

            

ICommonStructureService structureService = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));

 

 

Use ListAllProjects method to get all Team Projects in the TFS.

ProjectInfo[] projects = structureService.ListAllProjects();

list_projects.DataSource = projects;

 

image

Download Demo Project

Add comment
facebook linkedin twitter email

Leave a Reply

one comment

  1. suneetha08/07/2009 ב 15:13

    Hi

    Thankyou for your post.

    I want list usergroups in dropdown and then based on group selection I need to populate users in that perticular group.

    can you help me?

    Thanks
    Suneetha.