Retrieving deleted file history
Moderator: SourceGear
Retrieving deleted file history
I'm working with the API and I've encountered a problem. I need to get every version of a project from vault. Everything works fine for the moment except for deleted files.
The only way to retrieve history of a deleted file is to force an undelete on it and this makes a new log in the file history. So my question is, can we get the history of a deleted file without undeleting it ?
The only way to retrieve history of a deleted file is to force an undelete on it and this makes a new log in the file history. So my question is, can we get the history of a deleted file without undeleting it ?
You'll just need to create changeset items and commit them:
And you get a list of deleted items from a folder this way:
Code: Select all
VaultClientOperationsLib.ChangeSetItemColl items = new ChangeSetItemColl();
foreach (VaultDeletedObject d in deletedObjects)
{
VaultClientOperationsLib.ChangeSetItem item = null;
if (d != null)
{
item = new ChangeSetItem_Undelete(VaultDateTime.Now, String.Empty, String.Empty, d.ID, d.FullPath, d.DeletionID);
}
items.Add(item);
}
ret = _clientInstance.Commit(items);
Code: Select all
ClientInstance.ListDeletedObjects(_vFolder.FullPath, false);
One more thing.
Your routine work very well, it's easy to undelete every files with this, but, the comment are not showing up in Vault Client even if I change the 1st string.Empty and add a comment parameter in the .commit call. Is this an expected behavior ? Because I know you can't add comment directly from your Client application when undeleting objects but your API function support it.
Original code
Changed line #1 :
Changed line #2 :
Your routine work very well, it's easy to undelete every files with this, but, the comment are not showing up in Vault Client even if I change the 1st string.Empty and add a comment parameter in the .commit call. Is this an expected behavior ? Because I know you can't add comment directly from your Client application when undeleting objects but your API function support it.
Original code
Code: Select all
VaultClientOperationsLib.ChangeSetItemColl items = new ChangeSetItemColl();
foreach (VaultDeletedObject d in deletedObjects)
{
VaultClientOperationsLib.ChangeSetItem item = null;
if (d != null)
{
item = new ChangeSetItem_Undelete(VaultDateTime.Now, String.Empty, String.Empty, d.ID, d.FullPath, d.DeletionID);
}
items.Add(item);
}
ret = _clientInstance.Commit(items);
Code: Select all
item = new ChangeSetItem_Undelete(VaultDateTime.Now,"Automated Undelete", String.Empty, d.ID, d.FullPath, d.DeletionID);
Code: Select all
ret = _clientInstance.Commit(items,"Automated Undelete");