Revision history of pages

Delete revision history for pages

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.

Delete all but a specific number of revision history 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.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?

Next article

Retrieve page URL