如何将现有区域添加到现有团队?

How to add an existing Area to an existing Team?

我有一个使用 SDK 创建的区域,并且有一个团队。我如何使用 SDK 将该区域添加到团队?

使用迭代,使用 WorkHttpClient.PostTeamIterationAsync() 方法(下面的代码),这样做很简单,但是没有相应的方法可用于对区域执行相同的操作。

我简单地查看了该方法的源代码,但它包含一个 GUID 指示目标位置(迭代)。如果我能避免它,我宁愿不冒险通过修改它来降低到那个级别以供我自己用于区域。当然有更高级别的方法可以做到这一点。

根据this Q&A, it can be done via the REST API—but I'm using the SDK. Then there's this, but the answers there appear to be using an outdated version. The classes referenced aren't available in the latest stable version

这可以做到吗?


Private Function AddSprintToTeam(Sprint As Classifications.Iteration) As TeamSettingsIteration
  Dim oContext As TeamContext
  Dim oSprint As TeamSettingsIteration
  Dim oTeams As List(Of WebApiTeam)
  Dim oTeam As WebApiTeam

  Using oTeamClient As TeamHttpClient = Utils.Connection.GetClient(Of TeamHttpClient)
    Using oWorkClient As WorkHttpClient = Utils.Connection.GetClient(Of WorkHttpClient)
      oTeams = oTeamClient.GetTeamsAsync(ProjectName).Result
      oTeam = oTeams.Single(Function(Team) Team.Name.StartsWith(ProjectName))

      oContext = New TeamContext(ProjectName, oTeam.Name)
      oSprint = New TeamSettingsIteration With {.Id = Sprint.Identifier}
      oSprint = oWorkClient.PostTeamIterationAsync(oSprint, oContext).Result
    End Using
  End Using

  Return oSprint
End Function

您可以使用UpdateTeamFieldValuesAsync() 方法将现有区域添加到现有团队。检查 here.

参见 Rest api 文档中给出的相关 rest api here. You can check out the example