Page 1 of 1

Getting the local path for an item

Posted: Wed Apr 23, 2008 7:32 am
by MattTrinder
Hi

Given a vault path to a file

$/path/to/file.txt

Using the API, how can I get the path that the file is checked out to...?

ie. c:\develop\path\to\file.txt

Thanks

Matt

Posted: Wed Apr 23, 2008 8:13 am
by shannon
First you need to get the file id from the repository path (if you aren't using ServerOperations/RepositoryUtil, you can look at their code to see how its done there):

VaultClientFile vcf = RepositoryUtil.FindVaultFileatReposOrLocalPath(repoPath);
long fileId = vcf.ID;

Then get the check out list:

VaultCheckOutList coList = ServerOperations.ProcessCommandListCheckOuts();

Then loop over the VaultCheckOutItem objects and match for the one you're looking for by fileId. Once you have the VaultCheckOutItem object matched, then loop over the VaultCheckOutUser[] and match by some quality:

string localPath;
foreach (VaultCheckOutUser coUser in coItem.CheckOutUsers) {
if ( // match here by user name or some other quality)
localPath = coUser.LocalPath;
}

Hope that helps,
Shannon

Posted: Wed Apr 23, 2008 9:46 am
by MattTrinder
thanks, that got it... :D