C# VersionControlServer—在特定日期/时间获取文件的最新版本

C# VersionControlServer—在特定日期/时间获取文件的最新版本,c#,version-control,tfs,download,timestamp,C#,Version Control,Tfs,Download,Timestamp,我有一个程序使用以下代码从TFS服务器获取文件的最新版本 TeamFoundationServer myTFS = TeamFoundationServerFactory.GetServer(myURL); VersionControlServer myVCS = (VersionControlServer)myTFS .GetService(typeof(VersionControlServer)); ItemSet downloadItems = myVCS.GetItems(myDire

我有一个程序使用以下代码从TFS服务器获取文件的最新版本

TeamFoundationServer myTFS = TeamFoundationServerFactory.GetServer(myURL);
VersionControlServer myVCS = (VersionControlServer)myTFS .GetService(typeof(VersionControlServer));

ItemSet downloadItems = myVCS.GetItems(myDirectory, RecursionType.Full);
foreach (Item item in downloadItems.Items)
{
    item.DownloadFile(myDownloadPath);
}
我希望能够指定日期和时间,并在该时间点获取项目集,而不是获取最新版本。然后,在DownloadFile调用中,我想获取在指定日期和时间项集中文件的最新版本

我看到该项具有CheckinDate属性,但如果该值在我要查找的日期和时间之后,我不确定如何获取以前的版本。

当您使用查询项时,您应该提供您感兴趣的版本规范,在本例中为a

例如:

DateTime whenever = DateTime.Now;
ItemSet downloadItems = myVCS.GetItems(myDirectory, new DateVersionSpec(whenever), RecursionType.Full);
显然,将
DateTime.Now
替换为您感兴趣的任何内容。

当您使用查询项目时,您应该提供您感兴趣的版本规范,在本例中为

例如:

DateTime whenever = DateTime.Now;
ItemSet downloadItems = myVCS.GetItems(myDirectory, new DateVersionSpec(whenever), RecursionType.Full);
显然,现在用你感兴趣的任何东西来取代
DateTime