我调用IBuildServer.QueryBuilds(),并查看返回的IBuildDetail
:
如何在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;
答案 0 :(得分:0)
添加batchedrequests:
spec.QueryOptions = QueryOptions.Definitions
| QueryOptions.BatchedRequests; // Tell TFS2012 to populate RequestedFor / RequestedBy