TFS Team Query: get all changed work items since a given time
Apparently it is impossible to provide the Changed Date field with a timestamp (format '2009-12-14 10:00:0开发者_开发百科0') when defining a new Team Query. I get the error: "The query failed. You cannot supply a time with the date when running a query using date precision.".
Is there a workaround for this? I just want a list of work items which are changed since the last 'x' minutes.
The solution is to write your own WIQL query: http://teamfoundation.blogspot.com/2008/01/specifying-date-and-time-in-wiql.html.
You to enter the date in the same format as it is displayed by VSTS: dd-MMM-YY (01-Jan-16).
In order to filter your items in TFS by a specific date, stick to this format:
try adding query parameter timePrecision:true
. This worked for me
I ran into the same problem while trying to query for the latest updates and worked around it by doing the following
// defined elsewhere
private DateTime lastUpdated;
string consult = "select * from WorkItem where [Created Date] > ' " + lastUpdated.ToString("MM/dd/yy") +
"' AND [Work Item Type] = 'Test Case'";
IEnumerable<ITestCase> tcc = testManagementTeamProject.TestCases.Query(consult).Where(tp => tp.DateCreated > lastUpdated);
I did something very similar for retrieving test results
The last parameter of this query constructor lets you define the precision:
dayPrecision
When TRUE, indicates that a DateTime should resolve to an entire day. Often, it is TRUE to avoid being more precise about a specific time.
精彩评论