I am trying to use the TFS API to retrieve the latest code from the server within a workspace. I found this question:

How do you get the latest version of source code using the Team Foundation Server SDK?

Which is essentially what I want to do; however, I want to use an existing workspace, and only retrieve a certain section of the code. Is this possible?

For example (using the example given in the above question):

workspace.Get(request, GetOptions.GetAll | GetOptions.Overwrite, "$/MyFolder/MyProject");

Is something like this possible without setting up a new workspace or something?

有帮助吗?

解决方案

You need to gain access to your workspace with something like this:

var vcServer = teamProjectCollection.GetService<VersionControlServer>();
Workspace myWorkspace = vcServer.GetWorkspace("workspaceName", "workspaceOwner");

Then you get latest with a

 myWorkspace.Get();

or refine what you want get by consulting this.

In order to find out about your workspace(s) details navigate in VS to

"File" > "Source Control" > "Workspaces..."

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top