Hi,
I am trying to use the API to integrate Vault with our application, and I cannot figure out how to determine to whom a file is checked out.
I can call ClientInstance.IsCheckedOutByMeOnAnyMachine and ClientInstance.IsCheckedOutExclusiveByAnyone which at least tells me if it's Checked in, Checked out by someone else, or Checked out by me.
However, short of iterating through the user list and passing each username to ClientInstance.IsCheckedOutBySpecificUser, I can't see a way to determine the user that has a file checked out.
Any suggestions?
Vault API - Determining who a file is checked out to
Moderator: SourceGear
In the Vault GUI client, we use code like this to display all of the users who have a certain item checked out.
Code: Select all
foreach (VaultClientCheckOutItem coitem in myClientInstance.TreeCache.CheckOuts)
{
if (file.ID == coitem.FileID)
{
foreach (VaultClientCheckOutUser couser in coitem.CheckOutUsers)
{
// We may need a comma.
if (CheckOutUsers.Length > 0)
{
CheckOutUsers += ", ";
}
CheckOutUsers += couser.Name;
switch (couser.LockType)
{
case VaultCheckOutType.None:
break;
case VaultCheckOutType.CheckOut:
break;
case VaultCheckOutType.Exclusive:
CheckOutUsers += " (Exclusive)";
break;
}
}
// Stop us from looping through the rest of the IDs.
break;
}
}