我正在制作VSTS扩展程序,要求我将团队分开的工作项目。
REST API包含queryByWiql,其中包含WIQL query以及可选项目和团队。在下面的示例中,我在调用中包含了一个项目和团队,但结果包含所有项目中所有团队的所有打开的工作项,而不是仅包含分配给项目/团队的工作项。
function testing() {
VSS.require(["VSS/Service", "TFS/WorkItemTracking/RestClient", "TFS/Core/RestClient"],
function(VSS_Service, TFS_Wit_WebApi, TFS_Core_WebApi) {
//This gets the correct project information
var witClient = VSS_Service.getCollectionClient(TFS_Wit_WebApi.WorkItemTrackingHttpClient);
var projectId = VSS.getWebContext().project.id;
var coreClient = TFS_Core_WebApi.getClient();
var allteams = [];
var query = {
query: "SELECT [System.Id] "
+ "FROM WorkItem WHERE [System.WorkItemType] = 'Feature' "
+ "AND [System.State] NOT IN ('Closed','Completed','Removed','Done')"
};
//This gets all of the teams in the project
coreClient.getTeams(projectId).then(function(teams) {
allteams = teams;
}).then(function() {
//This should get the open work items for a specific team in a specific project
//Instead, 'result' contains all open work items from all projects
witClient.queryByWiql(query, allteams[0].projectName, allteams[0].id).then(function(result) {
VSS.notifyLoadSucceeded();
console.log(result);
});
});
});
}
在上面的示例中,result
应该只包含一个项目(allteams[0].name
)中一个团队(allteams[0].projectName
)的开放工作项。相反,result
包含所有工作项。
是否有不同的方法按团队过滤结果?