TFS Force Get Programmatically via SDK

I cannot find a way to get the file to get from TFS programmatically. My current code is:

_workspace.Get (new GetRequest (serverPath, RecursionType.None, new DateVersionSpec (dateTime)), GetOptions.Overwrite);

The code above will get the specific version, but if I manually delete the file, TFS thinks that it is still there. How can I use forced receipt for a specific version?

+4
source share
2 answers

To get strength, use GetOptions.GetAll . For instance:

 workspace.Get(new GetRequest(serverPath, RecursionType.None, new DateVersionSpec(dateTime)), GetOptions.Overwrite | GetOptions.GetAll); 
+5
source

I really understood that. The problem with using GetAll is that it gets everything, 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); 
-1
source

All Articles