Store and Retrieve Configutation Data

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


*** 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 —

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.


Post a comment or leave a trackback: Trackback URL.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: