More in this section

Forums / General Discussions / using CopyPageData

using CopyPageData

4 posts, 1 answered
  1. Phil
    Phil avatar
    89 posts
    19 Oct 2010
    01 Dec 2010
    Link to this post
    • I am trying to copy a page programatically.  When the CopyPageData() method executes I get the following error:

    Not a managed persistent instance.

    Parameter name: component

    Actual value was Telerik.Sitefinity.Pages.Model.PageNode.


    • Here is my code, which is commented to explain exactly where the problem is:

    var fluent = App.WorkWith().Page();

    var mgrFluent = fluent.PageManager;

    PageData sourcePageData =

    mgrFluent.GetPageDataList().Where(pd => pd.Title == "myExistingPageDataTitle").FirstOrDefault();

    // my MakeNewPage() creates a page that can display in the SF gui (a valid one)

    // and is in a row of both sf_page_data and sf_page_node

    PageData pd1 = MakeNewPage("theNewPageTitle4");


    var ci = new CultureInfo(CultureInfo.CurrentCulture.Name, true);

    // in debug both sourcePageData and pd1 are populated w id etc from db

    mgrFluent.CopyPageData(sourcePageData, pd1);

    //  same error if I use this overload

    // mgrFluent.CopyPageData(sourcePageData, pd1, ci, ci, true);

    How can I successfully use CopyPageData() ?  Thanks.

  2. Phil
    Phil avatar
    89 posts
    19 Oct 2010
    03 Dec 2010
    Link to this post
    Any progress on this?  Solving this is becoming critical on our Gantt chart.  :-)

  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    07 Dec 2010
    Link to this post
    Hello Phil,

    You have to operate with the page node instead of using the PageData object.

    var facade = App.WorkWith()
                .Page(new Guid(pageId))
    var node = facade.Get();

    You can get the page by another property using the LINQ expression and use a DO to set the properties on the duplicated page.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Phil
    Phil avatar
    89 posts
    19 Oct 2010
    07 Dec 2010
    Link to this post
    That worked.  On my first try I got the error: Object references between two different object scopes are not allowed ....   So I had to create the parent PageNode object and do the Duplicate method w the same App.WorkWith.Page object.

    var mgr = App.WorkWith().Page(guidSourcePage);

    PageNode parentPage =

    mgr.PageManager.GetPageNodes().Where(pi => pi.Id == parentId).FirstOrDefault();



                    p =>


                        p.Title = newPageName;

                        p.UrlName = newPageName;

                        p.ShowInNavigation = true;

                        p.Parent = parentPage; 

                        if (p.Page != null)


                            p.Page.Title = newPageName;



4 posts, 1 answered