Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers 3

up vote 6 down vote accepted

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!";
share|improve this answer
2  
+1 for the value :) –  Steve B Apr 23 '12 at 8:15
    
Agreed. I lol'd. –  RJ Cuthbertson Apr 23 '12 at 22:01
    
Is it possible to have property bags at scopes other than Web? –  Daryl Apr 24 '12 at 3:01
    
@Daryl property bags also for list like so _list.RootFolder.Properties["name"] = "value"; –  Vishal_Sharepoint Aug 17 '12 at 6:37
add comment

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/

share|improve this answer
add comment

This is very informative Link http://nitindeveloperspoint.blogspot.com.au/2012/07/store-custom-data-in-sharepoint.html

share|improve this answer
    
While this may theoretically answer the question, we prefer inclusion of the essential parts of the answer here, and to provide the link for reference. See answer for general guidelines. –  SPDoctor Aug 17 '12 at 7:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.