I can query for all builds within a TeamProject as follows:
var bServer = teamProjectCollection.GetService<IBuildServer>();
IBuildDetail[] builds = bServer.QueryBuilds("myTeamProject");
This yields all builds
within the given myTeamProject
. But I am only interested in yesterday's builds.
I can obviously filter after I 've gotten the results within builds
.
Still I am wondering if there exists an overload of QueryBuilds()
to get builds within a provided timespan.
Background:
In my original TFS build solution, a custom code activity would get catch the BuildDetail
properties that are important to us & would add them in an Excel sheet using Microsoft.Office.Interop.Excel.
This was rather convenient, since it took place during Build & our "BuildLog.xls" was always up-to-date.
Unfortunately this lead to this issue, so I had to remove the code activity & I am currently implementing Plan B: A console application scheduled to kick-in once a day, that queries for yesterday's builds & adds them in my Excel file.
You can create an IBuildDetailSpec object and specify the MaxFinishTime (the end of the time range) and MinFinishTime (the beginning of the time range) to get builds in a range.
IBuildServer has a method to create IBuildDetailSpec and a QueryBuilds method to query with this spec.