Hi,
How do I perform a rollback on a file through the API if I have the file and the version I want to revert to? I'm running Vault 6.1 Standard if it makes any difference.
Thank you
Performing a Rollback on a File
Moderator: SourceGear
Re: Performing a Rollback on a File
If you have a Vault Object Version ID, try creating a VaultClientOperationsLib.ChangeSetItem_Rollback(), adding it to a Change Set, and then committing that to the repository.
For example (C#):
For example (C#):
Code: Select all
using VaultClientOperationsLib;
long nTargetObjVerID = X; // where X = the Object Version ID of the file at $/some/path/to/file and version 2.
// create a change set
ChangeSetItemColl changeset = new ChangeSetItemColl();
// create a change set item for rollback
ChangeSetItem_Rollback rb = new ChangeSetItem_Rollback(VaultDateTime.Now, String.Empty, string.Empty, nTargetObjVerID, "$/some/path/to/file");
// add the item to the changeset
changeset.add(rb);
// commit the changeset... assumption is clientinstance has been allocated, login was successful and is set to the correct repository
try { clientinstance.Commit(changeset); }
catch (Exception e) { // TODO - log the exception and handle the exception }
Jeff Clausius
SourceGear
SourceGear