Get Latest using TFS API

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?

Answers


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..."


Need Your Help

Why submit button still works in extjs even if email validation with vtype is failed?

javascript extjs

Below is the extjs code for a window panel that has an email box and I used vtype:email to check for validation. The box shows error for invalid email but submit button still works. How can I throw...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.