using CopyPageData

Posted by Community Admin on 03-Aug-2018 23:43

using CopyPageData

All Replies

Posted by Community Admin on 01-Dec-2010 00:00

  • 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.

Posted by Community Admin on 03-Dec-2010 00:00

Any progress on this?  Solving this is becoming critical on our Gantt chart.  :-)


Posted by Community Admin on 07-Dec-2010 00:00

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

Posted by Community Admin on 07-Dec-2010 00:00

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;



This thread is closed