2014-10-01 127 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

相关问题