Search code examples
c#sourcegear-vault

How do I access properties of checked out files in Vault Client?


I'm developing a WinForms application with SourceGear's Vault Client .NET API

I want to get more information of files that are checked out. The code below loops through each file of checkouts.

Problem: the only (file) properties I can access are FileId and CheckOutUsers.

Expectation: I need to get File Name and additional info if available.

VaultClientCheckOutList chList = ServerOperations.ProcessCommandListCheckOuts();
foreach (var item in chList.Cast<VaultClientCheckOutItem>().ToList())
{
   list.Add(item.FileID.ToString());
}

Solution

  • The code below is the solution The first foreach-loop is to iterate over the checked out items. To access the files of a checked out item I had iterate over CheckOutUsers peroperty (second foreach-loop).

    List<string> list = new List<string>(); 
    VaultClientCheckOutList chList = ServerOperations.ProcessCommandListCheckOuts();
    foreach (var item in chList.Cast<VaultClientCheckOutItem>().ToList())
    {
        foreach (var file in item.CheckOutUsers)
            list.Add(file.LocalPath);
    }