Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Create a new dynamic property by code

Vote:
 

Hi,

I need to create a dynamic property in code and save it. How can I create a dynamic property? I can update the dynamic property but coudn't creat one

DynamicProperty dynProperty = DynamicProperty.Load(page.PageLink, "DynProp");
dynProperty .PropertyValue.Value = "value";
dynProperty .Save();

#79681
Dec 30, 2013 11:56
Vote:
 

I also tried the below but of no avail

 

otherProp = new PageDefinition();

otherProp.FieldOrder = prop.FieldOrder;

otherProp.Type = new PageDefinitionType(prop.Type.ID, prop.Type.DataType, prop.Type.Name);

otherProp.PageTypeID = page.ID;

otherProp.Tab = prop.Tab;

otherProp.Name = prop.Name;

otherProp.HelpText = prop.HelpText;

otherProp.EditCaption = prop.EditCaption;

otherProp.Searchable = prop.Searchable;

otherProp.Required = prop.Required;

otherProp.LanguageSpecific = prop.LanguageSpecific;

otherProp.LongStringSettings = prop.LongStringSettings;

otherProp.Save();

otherProp.ClearCache();

 

#79707
Dec 31, 2013 6:50
Vote:
 

This should work for you.

DynamicProperty dynamicProperty = DynamicProperty.Load(e.PageLink, "BlogPageReference");
 dynamicProperty.PropertyValue.Value = e.PageLink;
 dynamicProperty.Save();

    

#79709
Edited, Jan 01, 2014 7:54
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.