【问题标题】:Get all checkins from last few hours/day(s)/week(s)获取最近几个小时/天/周的所有签到
【发布时间】:2012-02-20 00:24:48
【问题描述】:

我想要一个团队项目在过去几个小时、几天、几周、...的签入列表。这可以通过 TFS SDK(以编程方式!!)实现吗?我该怎么做?

根据这些信息,我想根据最后一天的签到次数来做一些统计,比如项目活动。

谢谢!

【问题讨论】:

    标签: tfs-sdk


    【解决方案1】:

    我自己找到了解决方案。也许有人可以使用它:

    TfsTeamProjectCollection tfsTeamCol = new TfsTeamProjectCollection(new Uri(serverURL));
            VersionControlServer vcs = tfsTeamCol.GetService<VersionControlServer>();
    
            var history = vcs.QueryHistory("$/*", // The local path to an item for which history will be queried. This parameter can include wildcards
                                             VersionSpec.Latest, //Search latest version
                                             0, //No unique deletion id
                                             RecursionType.Full, //Full recursion on the path
                                             null, //All users
                                             new DateVersionSpec(DateTime.Now - TimeSpan.FromDays(7)), //From the 7 days ago ... 
                                             LatestVersionSpec.Instance, //To the current version ...
                                             Int32.MaxValue, //Include all changes. Can limit the number you get back.
                                             false, //Don't include details of items, only metadata. 
                                             false //Slot mode is false. 
                                            );
    
    int changesetCounter = 0;
            foreach (Changeset changeset in history)
            {
                changesetCounter++;
             //...
            }
    

    如果有更好的解决方案,请告诉我!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-26
      • 1970-01-01
      • 1970-01-01
      • 2015-06-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多