Question

They show in elements.xml files sometimes. What do they consist of? What scope do they live on? (Farm, Site, Web, or something different?) How do they interact with the rest of Sharepoint? What are their most common usage scenarios? Anything special about them I should know about?

I think they are some sort of typed name-value collection, but I have no idea what uses them or why.

Was it helpful?

Solution

Property bag is a collection, intended to hold your application's configuration data. There is a collection present at each SharePoint site. So in each SPWeb Object, you can use the collection theSPWeb.AllProperties the same way you use a hash table. For example:

spWeb.AllProperties["newValue"] = "OH SharePoint, you so buggy!";

OTHER TIPS

Property bags are powerful and good way to store properties and static details that is used in SharePoint. The Elements.xml file is used to define the property bag elements for the particular feature. Its something similar to entering key value pair configuration into your web.config file, for use within the application. Please find this detailed blog for more info.

There is a codeplex project which could give you an overview of how property bags can be used in SharePoint 2010 or 2007 - Property Bag Settings - http://pbs2010.codeplex.com/

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top