Page 1 of 1

Performing a Rollback on a File

Posted: Thu May 22, 2014 12:40 pm
by durgindaniel
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

Re: Performing a Rollback on a File

Posted: Fri May 23, 2014 1:27 pm
by jclausius
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#):

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 }