Introduction
Property bag is having property with their Key and Value. Its used to keep value and used it within a site. It will be used across the subsites, If we set a property in Main site collection. Let see how to set this property programmatically.
web.Properties.Update();
web.AllowUnsafeUpdates = false;
//Get a Property value
var r = SPContext.Current.Web.Properties["Your Property Key"]
Set Property
var web = SPContext.Current.Web;
web.AllowUnsafeUpdates = true;
web.Properties.Add("Key", "Value");web.Properties.Update();
web.AllowUnsafeUpdates = false;
//Get a Property value
var r = SPContext.Current.Web.Properties["Your Property Key"]
No comments:
Post a Comment