I'm having some real trouble with this one. I know there is a way to get the previous version of a file in C#, but I just can't seem to get it right. Here is what I am doing...
DateVersionSpec AfterCheckinDate = new DateVersionSpec(change.Item.CheckinDate);
DateVersionSpec BeforeCheckinDate = new DateVersionSpec(change.Item.CheckinDate.AddHours(-1));
//Download latest version
tfsVersionControl.DownloadFile(change.Item.ServerItem, 0, AfterCheckinDate, latestFile);
//Download yesterday's version
tfsVersionControl.DownloadFile(change.Item.ServerItem, 0, BeforeCheckinDate, dayOldFile);
It errors out on the change.Item.CheckinDate.AddHours(-1) line. I'm pretty sure it's because a version does not exist for that specific time.
Is there a way I can just retrieve the last VERSION of the file without specifying a time
Thank You,
Sam