The following code demonstrates how to delete the revision history for all pages up to a specified date:
In the code above, you iterate through all the page nodes. By calling the TruncateVersions method of the version manager, you can delete the revision history of a page. You do this by passing a page ID and a date up to which you want to delete the changes. Finally, you save the changes.
The following code sample demonstrates how to delete all but an exact number of revision history changes, for example, keep just the last 10 modifications you made to a page and delete all other changes:
In the code above, you iterate through all the page nodes. By calling the GetItemVersionHistory method of the version manager, you query all the revision history changes for a particular page. Next, you order the queried revision history changes by Version number. During this step, you apply the filtering conditions defining how many revision history changes to skip. When calling the TruncateVersions method of the version manager, you pass the ID of the content item and a Version number. As a result, all revision history changes with version smaller or equal to the specified number are deleted.
Sign up for our free beginner training. Boost your credentials through advanced courses and certification. Register for Sitefinity training and certification.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important