views:

72

answers:

2

I'm trying to programmatically intercept and cancel a user's attempt to check out a file in TFS.

Am I correct in thinking that the proper way to go about this would be to handle the NewPendingChange in a Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer ?

What is the proper way for canceling the event from its event handler?

A: 

The proper way to handle this is to remove the Checkout Permission on the file or folder you want to protect.

You can find more information at Team Foundation Server Permissions under the Source Control Permissions section.

Alfred Myers
Thanks Alfred but that doesn't help. I'm trying to impose "exclusive checkout" on .sln and .csproj files while keeping all other files in "multiple" checkout" mode. The TFS permission system doesn't allow that out of the box AFAIK.
urig
+1  A: 

I was wrong! TFS does allow me to disable merge and multiple check outs on sln/csproj files!

In the "Team Foundation Server Settings > Source Control File Types..." dialog I was able to add new file types (one for sln and one for csproj) and set the File Merging attribute on them to "Disabled". Works like a charm.

Too bad I still don't know how to answer my original question - how to cancel a NewPendingChange event.

urig