Store and Retrieve Configutation Data

http://msdn.microsoft.com/en-us/library/ff647766.aspx

Property Bag

A property bag enables you to add and retrieve properties to objects. Property bags are implemented as a simple hash table of property names and values. Do not attempt to store anything in property bags unless you are sure it can be serialized. Property bag can be accessed with the Properties property of an instance of the SPWeb class. If you want to store list-level configuration data, use the property bag of the root folder of the list.

SPFarm – Properties (SPPersistedObject)
SPWebApplication – Properties (SPPersisitedObject)
SPSite – AllProperties
SPWeb – AllProperties
SPList – RootFolder.Properties

Lists

*** Use list to store configuration data that end users can edit. Otherwise, consider using properties bag.

Here is an example to get a property from a web application property bag —

http://www.fivenumber.com/understanding-sharepoint-property-bag-settings/

Add property in SPFarm level

View property in SPFarm level

Add/Retrieve SPSite Proerty

Add/Retrieve SPWeb Property

You can also use Element.xml to save to property bag.

 

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: