using the API, how can i select an old version of a file, and copy to some other location on my system.
this is where i am right now:
VaultClientFolder searchFolder = _myClient.Repository.Root.FindFolderRecursive(vaultfileFolder);
VaultClientFile vaultFile = new VaultClientFile();
RecursivelySearchForFileName(searchFolder,newfilePath,ref vaultFile);
string diskFileInVault = _myClient.TreeCache.PhysicalPath(vaultFile);
_myClient.
StreamReader sr = new StreamReader(diskFileInVault);
string fileData = sr.ReadToEnd();
newFile = new FileInfo(dir.FullName + "\\" + newfilePath);
StreamWriter sw = newFile.CreateText();
right now, that is getting me the most latest version of the file because it is accessing the physical disk of where it is saved. How can get the data of a previous version?
thanks
Haider
Grab an old version
Moderator: SourceGear
Haider,
You can fetch an old version with ClientInstance.GetByDisplayVersionToNonWorkingFolder if you don't need to check it in.
You can fetch an old version with ClientInstance.GetByDisplayVersionToNonWorkingFolder if you don't need to check it in.
Code: Select all
VaultClientFile clone = vaultFile.Clone()
clone.Version = 4;
clone.ObjVerID = 0;
GetByDisplayVersionToNonWorkingFolder(clone, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, "C:\\temp", vaultFile.Parent.FullPath, null);