Is it possible to update the SPForm.JSLink property for the forms (Display, New, Edit) of an existing list in the when a feature is activated?
I have tried the code below, but it seems that the change is not being applied (i.e. the JSLink
property is null on subsequent feature activations):
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
// ...
someList.Forms.Cast<SPForm>().ToList().ForEach(form =>
{
form.JSLink = "~sitecollection/style library/myScript.js?v=" + Assembly.GetExecutingAssembly().FullName;
});
// ...
}
I have also tried calling someList.Update()
after assigning the property, but still no effect.
someList.Update();
after theforeach
is done?