Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Hi!
Here is some sample code that does a property for property copy from the current language to the hard coded language branch "SV". You can probably modify the code to fit your needs:
LanguageSelector selector = new LanguageSelector("SV");
PageData newLanguage = DataFactory.Instance.CreateLanguageBranch(CurrentPageLink, selector);
foreach (PropertyData property in CurrentPage.Property)
{
if (!property.IsLanguageSpecific || property.IsMetaData)
{
continue;
}
newLanguage[property.Name] = property.Value;
}
newLanguage.PageName =
CurrentPage.PageName + "- copy";
DataFactory.Instance.Save(newLanguage, SaveAction.Publish);
Regards
Linus Ekström
EPiServer Development Team
LanguageSelector selector = new LanguageSelector("SV");
PageData newLanguage = DataFactory.Instance.CreateLanguageBranch(CurrentPageLink, selector);
foreach (PropertyData property in CurrentPage.Property)
{
if (!property.IsLanguageSpecific || property.IsMetaData)
{
continue;
}
newLanguage[property.Name] = property.Value;
}
newLanguage.PageName =
CurrentPage.PageName + "- copy";
DataFactory.Instance.Save(newLanguage, SaveAction.Publish);
on.Publish);
I'm trying to copy a page with all its properties to a new language branch. Both CreateWritableClone and Createlanguagebranch don't copy the page properties. Is this possible?