Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dominic Tse 21 posts 110 karma points
    May 24, 2017 @ 07:20
    Dominic Tse
    0

    Determine previous version of the content change on a page

    Is it safe to to use cmsPreviewXml table to determine previous version of the content change on a page? E.g. the following SQL query would show all the versions on for any page like pagename.

    I could not find any documentation something like "umbraco content page versioning" in the forum and Google.

    SELECT [nodeId]
          ,[versionId]
          ,[timestamp]
          ,[xml]
      FROM [KMDevelop].[dbo].[cmsPreviewXml]
    WHERE [xml] LIKE '%pagename%'
    
  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    May 24, 2017 @ 09:07
    Alex Skrypnyk
    3

    Hi Dominic

    I would not recommend you to use SQL for working with versions.

    Try to use ContentService, you can get all versions of page with this code:

    var node = ApplicationContext.Services.ContentService.GetVersions(documentId);
    

    Also, you can get specific version and remove specific version.

    Thanks,

    Alex

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    May 24, 2017 @ 09:59
    Damiaan
    101

    What Alex said. Don't use SQL if you don't really need to.

    In case you have no alternative, cmsPreviewXml is for the previews only. I think you need cmsDocument and cmsContentVersion.

Please Sign in or register to post replies

Write your reply to:

Draft