London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
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?