.nettfs.net-3.5

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


Solution

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