How To: Get Build List Using TFS API


How To: Get Build List Using TFS API

Here is a example how to use TFS API to get Builds List per project.

In the next post I’ll show how to use GetListOfBuild as a Team Build Task that will help you override BuildNumberOverrideTarget.

using Microsoft.TeamFoundation.Build.Proxy;

TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(tfsUrl);
BuildStore buildStore = (BuildStore)tfs.GetService(typeof(BuildStore));
BuildData[] allBuilds = BuildStore.GetListOfBuilds(TeamProject, BuildType);

    foreach (BuildData build in allBuilds)


        string BuildMachine = build.BuildMachine;

        string BuildNumber = build.BuildNumber;

        string BuildQuality = build.BuildQuality;

        string BuildStatus = build.BuildStatus;

        string BuildStatusId = build.BuildStatusId;

        string BuildType = build.BuildType;

        string BuildTypeFileUri = build.BuildTypeFileUri;

        string BuildUri = build.BuildUri;

        string DropLocation = build.DropLocation;

        string FinishTime = build.FinishTime;

        string LastChangedBy = build.LastChangedBy;

        string LastChangedOn = build.LastChangedOn;

        string LogLocation = build.LogLocation;

        string RequestedBy = build.RequestedBy;

        string StartTime = build.StartTime;

        string TeamProject = build.TeamProject;


Add comment
facebook linkedin twitter email

Leave a Reply

one comment

  1. Gabe Cruz08/09/2010 ב 23:32

    You just rocked my world!!!!!!! Awesome, thank you

    Let me know if you are on twitter. Will follow. Thanks again!