Wednesday, February 22, 2012

Change Shelveset owner in TFS 2010

Inside TFS database schema, shelvesets are saved in tbl_workspace table with type=1.
use Tfs_defaultcollection;
select * from tbl_Workspace where type = 1 ;

One of the ways to get ownerID is from a developer's workspace name.
use Tfs_defaultcollection;
select * from tbl_Workspace where WorkspaceName='MYWORKSPACENAME';

To change the owner of a shelveset, run the following command:
use Tfs_defaultcollection;
update tbl_Workspace set ownerid=5 where type = 1 and WorkspaceName='shelvetest_3';

This may be useful after a develop leaves the team and his Active Directory ID is revoked.

Note: It is highly recommended not to modify TFS database directly.