获取最近几小时/天/周的所有签到

时间:2012-02-18 16:02:15

标签: tfs2008 tfs-sdk

我想要一个teamproject的检查列表,从过去的几小时,一天,一周,......这是否可以通过TFS SDK(以编程方式!!)?我怎么能这样做?

根据这些信息,我想根据最后一天的签到次数,制作项目活动等统计数据。

谢谢!

1 个答案:

答案 0 :(得分: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++;
         //...
        }

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