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

It seems that these code snippets ought to behave identically: 1: Monitor.TryEnter(object) if (Monitor.TryEnter(lockObject))
Seems that requirements on safety do not seem to like systems that use AI
It seems to me obfuscation is an idea that falls somewhere in the security
I have some code and it crashes upon execution, what seems to be wrong?
Seems to me most of developers completely ignore this features. People prefer handling security
Seems like a simple enough question but I can't seem to find the answer.
Seems like a simple problem: I have an SVN repo inside our firewall. I
Seems so basic, I can't believe I don't know this! I just need a
Seems like the subtraction is triggering some kind of issue and the resulting value
Seems likes it might be useful to have the assert display a message when

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.