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
Getting the local path for an item
Moderator: SourceGear
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
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