How to Update properties of sharepoint 2013 feature

I have a feature receiver for BCS model (Farm feature) and I am trying to update the value of a property "SiteUrl" dynamically in this receiver.

Below is the code:

properties.Definition.Properties["SiteUrl"].Value = "Some value";
properties.Feature.Properties.Update();

But I get the following error on the last line:

"Updating the properties of a feature definition is not supported."

Can anyone provide any inputs?


August 31st, 2015 10:11am

Hi,

Per my knowledge, the SPFeature.Properties object is used to get the collection of properties for the feature.For the property, it is used to internal set which means the code in the same assembly can read and set the property, but other code can only read the property.

I suggest you can directly add the property into the feature.xml.

Here are some detailed articles for your reference:

SPFeature.Properties property

What is internal set property in c#?

Here is a similiar thread for your reference:

How to Update properties of sharepoint 2010 feature

Thanks

Best Regards

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 3:33am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics