views:

38

answers:

2

I would like to write a quick macro or add-in to allow me to quickly toggle the "Show Deleted Items" option in the TFS Solution explorer.

I cannot seem to find the proper command to use to set that option programmatically (in the IDE, it is found at Tools | Options | Source Control | Visual Studio Team Foundation Server | Show deleted items in the Source Control Explorer).

Can anyone give me some pointers as to where to look? I have installed the Visual Studio SDK, but the documentation seems to be incomplete -- I have documentation for the TeamFoundationServer object, but none of the others (like the VersionControl class), so I've been poking around with intellisense, and not having much luck.

+1  A: 

Sounds like you are wanting to write an add-in to Visual Studio to quickly affect this behavior rather than going to the preference each time.

I don't think this is exposed via the TFS object model in a publicly accessible class. It appears that this preference is ultimately stored in the registry key in HKCU\Software\Microsoft\VisualStudio\9.0\TeamFoundation\SourceControl - however the preference appears to be cached in memory in the running application - meaning that if you set the registry key directly then you'd have to restart Visual Studio to get it to pick up the preference.

Often preferences like this are implemented using an internal "Settings" style class that the preference dialog page would have access to along with the things using the setting (such as the Source Control Explorer). As the preference dialog and the thing using the preference are usually contributed into Visual Studio by the same assembly then both could see an internal class that you'd only have access to by using reflection or something nasty like that.

Martin Woodward
That's kind of what I was afraid of. I was hoping I could find the setting in DTE.Properties -- A lot (but not all) of the environment options are in there. Here's an example that you could use to set the debugging options in VS: http://www.codepaste.net/rha8b5 The trick is, you have to know the right strings to pass in. I'm either not using the right strings, or the option just isn't there.
JMarsch