Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4062662
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:37:36+00:00 2026-05-20T15:37:36+00:00

It seems no overloads of IBuildServer.QueryBuilds(…) allows me to do that. Here’s my code:

  • 0

It seems no overloads of IBuildServer.QueryBuilds(...) allows me to do that.

Here’s my code:

TfsTeamProjectCollection tfs = context.GetValue(TeamProject);
IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
buildServer.QueryBuilds( // **what should i put here?**

I don’t want to specify the build definition, because the build I want may be of any type.

This question seems easy, but googling it gave me no answers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:37:37+00:00Added an answer on May 20, 2026 at 3:37 pm

    This code will get all builds . . . ever

    TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("http://tfs:8080"));
    
    var vcs = tfs.GetService<VersionControlServer>();
    
    var teamProjects = vcs.GetAllTeamProjects(true);
    
    IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
    
    foreach (TeamProject proj in teamProjects)
    {
        var builds = buildServer.QueryBuilds(proj.Name);
    
        foreach (IBuildDetail build in builds)
        {
            var result = string.Format("Build {0}/{3} {4} - current status {1} - as of {2}",
            build.BuildDefinition.Name,
            build.Status.ToString(),
            build.FinishTime,
            build.LabelName,
            Environment.NewLine);
    
            System.Console.WriteLine(result);
        }            
    }
    

    However, you’re probably more interested in this code, which enumerates each team project and gets the latest build status for each of the definitions:

    TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("http://tfs:8080"));
    
    var vcs = tfs.GetService<VersionControlServer>();
    
    var teamProjects = vcs.GetAllTeamProjects(true);
    
    IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
    
    foreach (TeamProject proj in teamProjects)
    {
        var defs = buildServer.QueryBuildDefinitions(proj.Name);
    
        System.Console.WriteLine(string.Format("Team Project: {0}", proj.Name));
    
        foreach(IBuildDefinition def in defs)
        {
            IBuildDetailSpec spec = buildServer.CreateBuildDetailSpec(proj.Name, def.Name);
            spec.MaxBuildsPerDefinition = 1;
            spec.QueryOrder = BuildQueryOrder.FinishTimeDescending;
    
            var builds = buildServer.QueryBuilds(spec);
    
            if (builds.Builds.Length > 0)
            {
                var buildDetail = builds.Builds[0];
    
                System.Console.WriteLine(string.Format("   {0} - {1} - {2}", def.Name, buildDetail.Status.ToString(), buildDetail.FinishTime));
            }                
        }
    
        System.Console.WriteLine();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've implemented a class that overloads the == and != operators. This seems to
So it seems that the non-generic overload of Html.ActionLink() works nicely with HTML5 data-
It seems both can be overloaded, but somebody said not..... What's the case?
Seems like cuke doesn't show the full error message (at least when problem occurs
Seems when I make move refactoring all my junit tests lays on its old
Seems like a standard approach for an ioc when given a scenario like (C#
Seems everyone recommends virtualenv for multiple python versions (on osx), but does it even
Seems like this should be obvious, but how do I send arrow key presses
Seems there's nothing to do… using the combo prototype/lowpro, no problems at all with
Seems like this should be simple, but powershell is winning another battle with me.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.