John
John

Reputation: 3677

Check out and check in programatically using TFS API

We would like to check out and check in programatically using TFS 2010 or possibly 2012. The catch is this: it has to be done without a local workspace. Why?

The "check out" and "check in" button would appear on an administration website. The website in itself handles a bunch of configuration files that all need to be checked in to TFS. We are looking to do that via the said buttons.

There are also buttons to "save" and "edit" without using the check in/out option. In other words, the user has to be able to choose whether he wants to just edit and save his changes without using TFS, or whether he wants to use TFS by checking out/checking in his changes.

My questions:

  1. Is it possible to programatically check out a single file (this would be an .xml file) without a local workspace?
  2. Are there other roadblocks that I might not be aware of?
  3. Would this be doable somehow and what's the best way to get this done?

Important notes: The website is an ASP.NET closed-source website that can be extended via plugins (e.g. adding a custom button like the "check in" or "check out" button above). That is why the files need to be editable/writeable at all times (while checked in files are read-only).

Upvotes: 0

Views: 1224

Answers (2)

Assaf Stone
Assaf Stone

Reputation: 6317

There is no such thing as checking in or out without a workspace. What you can do, is to programmatically create a workspace for your plugin, do your checking out and then decide whether to keep it for reuse, or delete it.

If by "no local workspace", you mean that the workspace should actually exist (even if momentarily) on the asp server, then that's fine. That's what TFS does with workspaces when getting the sources that need to be built.

Upvotes: 0

Dan Puzey
Dan Puzey

Reputation: 34200

It's possible to check out a file without having a local copy of the file, but you do have to have a workspace. However, you can't check back in without having a local copy of the file - because there's nothing to check in without the workspace existing. (Else, what would you be checking in?)

It's possible to create and delete workspaces programmatically and for any user, though - so perhaps what you need is to create a workspace on the server, possibly under a service user.

Upvotes: 1

Related Questions