• FarmSo we can share the information across different web where a list failed to do that and also able to persist information across farm.
• Server
• Web Application
• Site Collection
• Site
• List
SPWeb exposes two properties to store the information one is AllProperties which equivalent to a hashtable and supports case sensitive keys.Second one is properties (PropertyBag) and no supports for case sensitive keys.
using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb web= site.OpenWeb()) {
// Add a property entry
web.Properties[key] = value;
web.AllProperties[key] = value;
web.Update();
web.Properties.Update();
// Remove a property entry
web.AllProperties.Remove(key);
web.Properties[key] = null;
web.Update();
web.Properties.Update();
}
}
We can also serialize the object and store in the propertybags.Sounds cool !!
You can download Property bag settings from http://pbs.codeplex.com/ and more details about managing configuration information http://spg.codeplex.com/Wiki/View.aspx?title=Managing%20Application%20Configuration&referringTitle=Home
No comments:
Post a Comment