【问题标题】:TFS and powershellTFS 和 powershell
【发布时间】:2015-06-11 02:50:13
【问题描述】:

我可以创建我的任务using the script here

我的问题是如何告诉 Powershell 将这些创建的任务链接到特定的用户故事下。例如,我在用户故事 1950 下创建了 Task# 2000,它是“回归测试”。我如何将它们联系起来?感谢任何帮助。

【问题讨论】:

  • 顺便说一句,我不是开发人员。我只是想创建这个查询,以便我可以快速自动创建我的任务,这将在每个 sprint 中为我节省几个小时。

标签: powershell tfs-sdk tfs-workitem


【解决方案1】:

这是一个非常简化的代码,只是为了让您开始链接工作项。

(只需确保此路径中存在 TeamFoundation dll 或更改它)

    Add-Type -Path "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.Client.dll"
    Add-Type -Path "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.WorkItemTracking.Client.dll"

    $type = "Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore" -as [type]

    // Create the TF
    $tfs = New-Object Microsoft.TeamFoundation.Client.TeamFoundationServer("http://server/tfs/collection")
    $store = $tfs.GetService($type)


    $project = $store.Projects["WITLab"] // select the Teamproject
    $parentWorkitem =  $project.Store.GetWorkItem(53) // get the parent workitem by ID
    $rl = New-Object Microsoft.TeamFoundation.WorkItemTracking.Client.RelatedLink(40) // create related link with the child ID 

    //Add the link and save the Workitem
    $Parentwit.Links.Add($rl)
    $Parentwit.Save()

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-11-04
  • 2015-04-24
  • 2021-03-09
  • 2015-05-29
  • 2013-07-09
  • 2019-01-24
  • 1970-01-01
相关资源
最近更新 更多