November Happy Hour will be moved to Thursday December 5th.

Create new pages from code

Vote:
 
Is there a best practice available for how to create pages in EPiServer CMS 5 programatically?
#15863
Nov 08, 2007 11:47
Vote:
 
I dont know, but I do like this in EpiServer 5, and it works fine ! int intRefId = 123; // id to parent PageReference prParent = new PageReference(intRefId); PageData pdNewEpiPage = null; pdNewEpiPage = EPiServer.DataFactory.Instance.GetDefaultPageData(prParent, "MyPageTypeName", EPiServer.Security.AccessLevel.NoAccess); pdNewEpiPage.PageName = "My Instance Name"; pdNewEpiPage.SetValue("Prop1", "My Prop1 Value"); pdNewEpiPage.SetValue("Prop2", "My Prop2 Value"); PageReference prNewEpiPage = EPiServer.DataFactory.Instance.Save(pdNewEpiPage, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess); int intNewId = prNewEpiPage.ID; // Done ! Maybe this is not what you asked, please comment if so !
#16520
Nov 08, 2007 21:23
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.