【发布时间】:2018-10-03 08:04:20
【问题描述】:
我有一个使用 TFS JAVA SDK 14.0.3 的应用程序。 我的 tfs 上有一个共享查询,如何运行共享查询并使用 TFS SDK 14.0.3 获取响应
我还可以看到查询 url 将每 90 天过期一次,那么有没有更好的方法来执行共享查询?
现在我有一个运行查询的方法,我也想要一个运行共享查询的方法。
public void getWorkItem(TFSTeamProjectCollection tpc, Project project){
WorkItemClient workItemClient = project.getWorkItemClient();
// Define the WIQL query.
String wiqlQuery = "Select ID, Title,Assigned from WorkItems where (State = 'Active') order by Title";
// Run the query and get the results.
WorkItemCollection workItems = workItemClient.query(wiqlQuery);
System.out.println("Found " + workItems.size() + " work items.");
System.out.println();
// Write out the heading.
System.out.println("ID\tTitle");
// Output the first 20 results of the query, allowing the TFS SDK to
// page
// in data as required
final int maxToPrint = 5;
for (int i = 0; i < workItems.size(); i++) {
if (i >= maxToPrint) {
System.out.println("[...]");
break;
}
WorkItem workItem = workItems.getWorkItem(i);
System.out.println(workItem.getID() + "\t" + workItem.getTitle());
}
}
【问题讨论】:
-
共享查询是已经运行并保存的查询,所以你需要的是获取共享查询,而不是运行共享查询。