views:

247

answers:

2

Hi;

In Team Foundation, you can ask Team Explorer to show deleted files by doing this:

Tools > Options > Source Control > Visual Team Foundation Server > Show deleted items in the Source Control Explorer.

My question is how do you do the same thing programatically?

I am developing a synchronisation tool, and I need to detected deleted files in TFS. Workspace.Get(...) returns only non-deleted files.

Any idea how I can achieve that? Thank you.

A: 

Go to the Visual Studio folder in your start menu and start up a Visual Studio Command Prompt from the "Visual Studio Tools" subfolder.

The command you want to run is:

tf dir /server:myserver $/myproject /recursive /deleted

(where myserver and myproject are your server and project)

use "tf help" for general info, "tfs help dir" for more help on this command, or google on "tf.exe" for more info.

Jason Williams
Hi Jason;Thank you for help. I experimented with the command and it adds a deletionId next to the deleted items.Do you know if it's possible to the same thing with the managed API? or with any other API for that matter.Thank you.
I would imagine so, but I haven't used that part of the API, so can't answer you authoritatively.
Jason Williams
I finally found out how:ItemSet itemSet = sourceControl.GetItems(path, VersionSpec.Latest, RecursionType.OneLevel, DeletedState.Any, ItemType.Any);TY.
A: 

The VersionControlServer.QueryHistory API will give you access to the changesets which will contain all version control operations including deletes.

William D. Bartholomew