Reputation: 524
I can't figure out any way to force get a file from TFS programmatically. My current code:
_workspace.Get(new GetRequest(serverPath, RecursionType.None, new DateVersionSpec(dateTime)), GetOptions.Overwrite);
The above code will get a specific version, but if I manually delete the file, TFS thinks its still there. How can I use a force get for a specific version?
Upvotes: 4
Views: 1152
Reputation: 524
I actually figured it out. The problem with using GetAll is, that it gets all and I just want one specific version of a specific file.
This is what I did:
_controlServer.GetItems(serverPath, new DateVersionSpec(dateTime), RecursionType.None).Items[0].DownloadFile(_workspace.GetWorkingFolderForServerItem(serverPath).LocalItem);
Upvotes: -1
Reputation: 78863
To do a force get, use GetOptions.GetAll
. Eg:
workspace.Get(new GetRequest(serverPath, RecursionType.None, new DateVersionSpec(dateTime)), GetOptions.Overwrite | GetOptions.GetAll);
Upvotes: 5