+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Programmatically cancel page changes

Programmatically cancel page changes

5 posts, 1 answered
  1. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    07 Apr 2011
    Link to this post
    Hi,

    I want to programmatically cancel changes on a locked page. The same as when an admin click on the "Cancel changes" in the red ribbon at the top of a locked page, in administration.

    I tried:
    myLockedPage.Staged.Rollback();
    and/or
    myLockedPage.Staged.UndoCheckOut();

    but both leave the page in the wrong status, like draft or unpublished...

    What is the right way to do it ?

    Thanks,

    Olivier
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Apr 2011
    Link to this post
    Hello Olivier,

    I check a this and the page gets published.

                    Telerik.Cms.IPage pCancel = cmsManager.GetPage(someID), true);
                    pCancel.Staged.UndoCheckOut();

    Greetings,
    Ivan Dimitrov
    the Telerik team

  3. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    07 Apr 2011
    Link to this post
    Hi Ivan,

    Did you test with the workflow enabled ? I forgot to mention it is.

    The resulting status after a UndoCheckOut() is Approved.

    Thanks,

    Olivier
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Apr 2011
    Link to this post
    Hello Olivier,

    It is working with workflow as well.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Answered
  5. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    07 Apr 2011
    Link to this post
    Ok, thank you
Register for webinar
5 posts, 1 answered