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

jQuery add z-index value to a series of images

javascript jquery image gallery z-index

Simple concept, but I'm having trouble coming up with an elegant solution.

Is it true that one should not use NSLog() on production code?

iphone objective-c nslog

I was told this a few times in this very site, but I wanted to make sure this is really the case.

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.