我正在嘗試對TFS2010中的工作項目進行大量驗證。我明白可以使用微軟給出的開箱即用的規則來完成驗證,但我期待進行更高級的驗證。例如,TFS工作項目交叉驗證是可能的嗎?
1)如果前一個Sprint正在進行,則不應發生Sprint Planning。
2)我也在尋找工作項目類型之間的驗證。例如,除了當前Sprint中計劃的狀態更改外,所有用戶故事都不應允許進行狀態更改。
是有可能通過API,如果是指導我上面兩個是我的要求....
另一個查詢,或者是有可能寫驗證錯誤,這scenario..say當我們試圖保存任何無標題它拋出TF20012工作項...
同樣,我們可以處理這種情況?如果是的話引導我...
但我想這樣,啓動我試圖這樣下面的代碼以前的衝刺說我包括開始和結束日期跟蹤,如果是的話,那麼我必須寫出所有n次衝刺,結束了...哪種方式最好去ahea d
Uri tfsUri = (args.Length < 1) ?
new Uri("http://cscdbche646:8080/tfs") : new Uri(args[0]);
TfsConfigurationServer configurationServer = TfsConfigurationServerFactory.GetConfigurationServer(tfsUri);
// Get the catalog of team project collections
ReadOnlyCollection<CatalogNode> collectionNodes = configurationServer.CatalogNode.QueryChildren(
new[] { CatalogResourceTypes.ProjectCollection },
false, CatalogQueryOptions.None);
// List the team project collections
foreach (CatalogNode collectionNode in collectionNodes)
{
// Use the InstanceId property to get the team project collection
Guid collectionId = new Guid(collectionNode.Resource.Properties["InstanceId"]);
TfsTeamProjectCollection teamProjectCollection = configurationServer.GetTeamProjectCollection(collectionId);
// Print the name of the team project collection
Console.WriteLine("Collection: " + teamProjectCollection.Name);
// Get a catalog of team projects for the collection
ReadOnlyCollection<CatalogNode> projectNodes = collectionNode.QueryChildren(
new[] { CatalogResourceTypes.TeamProject },
false, CatalogQueryOptions.None);
// List the team projects in the collection
foreach (CatalogNode projectNode in projectNodes)
{
Console.WriteLine(" Team Project: " + projectNode.Resource.DisplayName);
// Get the work item store
WorkItemStore workItemStore = teamProjectCollection.GetService<WorkItemStore>();
// WorkItemCollection queryResults = workItemStore.Query(" Select [State], [Title] From WorkItems Where [Work Item Type] = 'Bug'");
WorkItemCollection queryResults = workItemStore.Query("Select [Work Item Type] = 'User Story' From WorkItems Where [State] = 'Closed' And ([System.StartDate.SDate] = '10/05/13') And ([System.EndDate.EDate] = '20/05/13')");
foreach (WorkItem wi in queryResults)
{
Console.WriteLine("State = " + wi.State.ToString());
Console.WriteLine("Title = " + wi.Title.ToString());
//string oldAssignedTo = (string)wi.Fields["State"].Value;
//wi.Fields["State"].Value = "In-Progress";
if (wi.IsDirty)
Console.WriteLine("The work item state cannot be changed.");
string oldAssignedTo = (string)wi.State;
wi.Fields["State"].Value = oldAssignedTo;
wi.Save();
}
}
}