调用QueryBuilds()后,不会填充IBuildDetail.RequestedFor

时间:2013-03-13 18:41:09

标签: tfs2012

我调用IBuildServer.QueryBuilds(),并查看返回的IBuildDetail

  • TFS2010:它们填充了用户别名。
  • TFS2012:它们为空。

如何在TFS2012中获取用户名?

var collection = new TfsTeamProjectCollection(new Uri(_txtCollection.Text));
var buildServer = collection.GetService<IBuildServer>();

var spec = buildServer.CreateBuildDetailSpec(Settings.Default.ProjectName);
spec.QueryOptions = QueryOptions.Definitions;
spec.QueryOrder = BuildQueryOrder.StartTimeDescending;
spec.InformationTypes = null;

return buildServer.QueryBuilds(spec).Builds;

1 个答案:

答案 0 :(得分:0)

添加batchedrequests:

spec.QueryOptions = QueryOptions.Definitions
                  | QueryOptions.BatchedRequests;  // Tell TFS2012 to populate RequestedFor / RequestedBy