尝试更新团队字段值时出错

Errors when attempting to update team field values

当我尝试使用客户端 SDK 将现有区域添加到现有团队时,我遇到了多个错误中的任何一个。这是我的代码:

Using oTeamClient As TeamHttpClient = Utils.Connection.GetClient(Of TeamHttpClient)
  Using oWorkClient As WorkHttpClient = Utils.Connection.GetClient(Of WorkHttpClient)
    oValue = New TeamFieldValue With {.Value = Area.Path, .IncludeChildren = False}
    oTeams = oTeamClient.GetTeamsAsync(ProjectName).Result
    oTeam = oTeams.Single(Function(Team) Team.Name.StartsWith(ProjectName))
    oPatch = New TeamFieldValuesPatch With {.Values = {oValue}, .DefaultValue = $"{ProjectName}\{Area.Path}"}
    oContext = New TeamContext(ProjectName, oTeam.Name)

    Return oWorkClient.UpdateTeamFieldValuesAsync(oPatch, oContext).Result
  End Using
End Using

问题是我不知道用什么 TeamFieldValuesPatch.DefaultValue

这是我尝试过的方法以及每次尝试的相应错误消息:

遗憾的是,the documentation 没有对此 属性 的验证规则提供任何解释,也没有提供任何关于我们应该使用什么值的指导。它似乎表示项目名称+区域路径,但正如我们在上面看到的那样不起作用。

this, but it conflicts with the (obscure) hint in the documentation. There's this,但在尝试更新之前我已经验证该区域存在。

我应该为此使用什么值 属性?

以上错误The default team field value must be one of this team's allowed team field values表示 您在 TeamFieldValuesPatch.DefaultValue 属性 中定义的区域路径也必须包含在 TeamFieldValuesPatch.Values 属性 中。

如果在Values中找不到为DefaultValue定义的区域路径。以上错误将被抛出。请参阅以下 c#

中的示例
 VssConnection _connection = new VssConnection(accountUri, new VssBasicCredential(string.Empty, personalAccessToken));

 WorkHttpClient workClient = _connection.GetClient<WorkHttpClient>();
 TeamFieldValuesPatch patch = new TeamFieldValuesPatch();
 patch.DefaultValue = "Project\DefaultAreaPath";
            
 List<TeamFieldValue> values = new List<TeamFieldValue> { 
   #defaultValue must be included in the values 
   new TeamFieldValue { Value = "Project\DefaultAreaPath", IncludeChildren = false },
   new TeamFieldValue { Value = "Project\OtherAreaPath", IncludeChildren = false }
 };
            
 patch.Values = values;
 TeamContext team = new TeamContext("Project", "Team");

 var res = workClient.UpdateTeamFieldValuesAsync(patch, team).Result;