Reputation: 45
While trying to checkout a file \ folder in a Workspace, I get 0 as a result if the action was failed. Usually it fails because someone else already checked it out with lock.
Welp, I would like to know who is this user (to bump his ass). How do I do that?
My code:
var workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo(folder);
var server = new TfsTeamProjectCollection(workspaceInfo.ServerUri);
var workspace = workspaceInfo.GetWorkspace(server);
int result = workspace.PendEdit(new[] { jsonFile }, RecursionType.Full, null, LockLevel.CheckOut);
if (result == 0)
{
// How to get the user's name ?
}
Upvotes: 2
Views: 865
Reputation: 23796
TfsTeamProjectCollection coll = YOURTEAMPROJECTCOLLECTION;
PendingSet[] pending = coll
.GetService<VersionControlServer>()
.QueryPendingSets(new[] { jsonFile }, RecursionType.None, null, null);
'pending' will contain any pending changesets, who has it checked out, etc.
Upvotes: 2
Reputation: 3268
In Visual Studio 2012 you get the name of the locker person in the Output window
Upvotes: 0