2014-10-01 40 views
0

我正在創建一個Visual Basic Windows窗體應用程序,它在瀏覽器版本的TFS上具有與新任務創建頁面相似的輸入字段。這個想法是自動化一些表格填充節省時間(是,計算時間估計基於日期考慮到工作時間和週末,自動填寫字段)如何以編程方式創建新的TFS任務?

當我搜索谷歌,但我不斷收到像自定義TFS或如何使用界面創建新任務,但是我正在尋找的是我應該使用哪些類來創建新任務,然後保存它或搜索當前的現有任務。

那麼如果可能的話,如何以編程方式創建新的TFS任務? (應該是,Visual Basic和TFS都是微軟的)

回答

7

在MSDN上有一個例子。見本頁:「Create a Work Item By Using the Client Object Model for Team Foundation」。

的例子的核心是:

// Create the work item. 
WorkItem userStory = new WorkItem(workItemType) 
{ 
    // The title is generally the only required field that doesn’t have a default value. 
    // You must set it, or you can’t save the work item. If you’re working with another 
    // type of work item, there may be other fields that you’ll have to set. 
    Title = "Recently ordered menu", 
    Description = "As a return customer, I want to see items that I've recently ordered." 
}; 

// Save the new user story. 
userStory.Save(); 
+0

這是行不通的。我得到TokenUnauthorized。 {「TF30063:您無權訪問http://tfs.mycompany.com:8080/tfs。」}但是我可以使用(設計不佳的)Web界面創建任務。 – 2015-10-26 17:03:49

相關問題