Creating pages programmatically

Vote:
 
hi I'm trying to create pages in episerver 4.41.7.71 in a code segment EPiServer.Core.PageData newPage = Global.EPDataFactory.GetDefaultPageData(myParentPage, myPageTypeName); PropertyData pageProp; for (int i = 0; i < myProperties.Count; i++) { pageProp = (PropertyData) myProperties[i]; if (newPage.Property.Exists (pageProp.Name)) { newPage.Property[pageProp.Name].Value = pageProp.Value; } } newPage.LanguageID = "SE"; EPiServer.Global.EPDataFactory.Save (newPage, EPiServer.DataAccess.SaveAction.Save) I'm using multilanguage and when I save the I get three versions of it one in common, one in swedish and one in english. It works when there are no language properties on the page. Is it a bug or have I made something wrong? help please regs //Stefan
#17455
Mar 25, 2008 19:33
Vote:
 
Hi Stefan! I would guess that this is not a bug but instead a feature introduced in the 4.50 release that is also included in your hotfix. The multi language runtime will check the page when saved and split in into several versions if necessary. This faq explains more about this: http://www.episerver.com/templates/faq____3840.aspx
#18240
Mar 25, 2008 19:43
Vote:
 
hi Thanks, but the example explains how to change an already existing page what I wanted to do was to create a page from scratch, but I think I've figured that one out by doing a quicksave before adding values to the properties on the page, see another question by me ;). regs //Stefan
#18241
Mar 25, 2008 19:43
* 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.