这是我的第一个问题:)
我想知道是否有类似于WIQL (TFS工作项查询语言)的解析器。我正在处理TFS查询,我必须对其中的一些字段进行编程更改。搜索语法分析或其他东西对我来说没有结果。你能帮帮我吗?
注意:我必须更改查询本身。不是任何工作项。
谢谢你们。
发布于 2016-02-16 17:16:30
您可以使用REST api或.net api:
POST https://{instance}/defaultcollection/[{project}/]_apis/wit/wiql?api-version={version}
Content-type: Application/json
{
"query": string
}// credentials if required
System.Net.ICredentials credentials = new System.Net.NetworkCredential("User", "Password", "Domain");
// create the collection
Microsoft.TeamFoundation.Client.TfsTeamProjectCollection teamProjectCollection =
new Microsoft.TeamFoundation.Client.TfsTeamProjectCollection(new Uri(@"http://tfsServer:8080/tfs/collection"), credentials);
// check we are authenticated
teamProjectCollection.EnsureAuthenticated();
// create the work item store
Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore Store =
(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore)
teamProjectCollection.GetService(typeof(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore));
// create a query to select tasks
string query = "SELECT * FROM WorkItems WHERE [System.WorkItemType] = 'Task' AND [System.IterationPath] = '@IterationPath' ORDER BY [System.WorkItemType], [System.Id]";
// replace the iteration
query = query.Replace("@IterationPath", "IterationPath");
// query the store!
Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemCollection WIC = Store.Query(query);https://stackoverflow.com/questions/35409232
复制相似问题