Property Bag in SharePoint 2013: Complete Information
Basically, the property bag is a hash table, which is used to store the data in key-value pairs. And, SharePoint also allows users to store the configurations in different hierarchy levels through property bags. In this article, we will discuss property bags, its features and reasons behind using the SharePoint property bags in details. You will also get to know the method to use property bags in this write-up.
What is Property Bag in SharePoint 2013?
The SharePoint property bag is a good place to store the meta-data or properties of SharePoint 2013 site. A property bag can accumulate the key and value like a couple that can be used in the Farm, Site, Web Application, and Web level. However, it doesn’t provide an option to view, add, edit and delete the key-value. But, there is an option to perform the actions on property bag in SharePoint 2013. Because, it allows to store and retrieve the custom configurations, instead of having to store them in the web.config files. Moreover, property bags of SharePoint stores the configuration data in the hash table that means key-value format.
Features Of Property Bag
1. The property bag settings can safely store and retrieve the properties at the following levels:
- Farm (SPFarm)
- Web application (SPWebApplication)
- Site collection (SPSite)
- The site (SPWeb)
- List (SPList)
- Folder (SPFolder)
- File (SPFile)
- List Item (SPListItem)
2. It is able to import and export property bags.
3. Allows to access property bags from Site Settings or Central Administration
4. Encrypting property bag value.
Reasons Behind Using the Property Bag in SharePoint 2013
In the current technical era, many people are using SharePoint property bags. Because, it is able to store any meta-data as Key-Value pairs like server names, file paths, connection strings, and many other settings which are needed for SharePoint application. Most of the time, users store the configuration settings in the file, which is very common for the entire web application. If there is any setting applied to each individual sites in the web application, then it is required to maintain those settings in the configuration file. For this purpose, one can use the SharePoint property bag.
How to Specify the Properties in the Property Bag?
||It is an optional text, which specifies an absolute URL to use as the base URL for hyperlinks.
||It is also an optional text that specifies the ID of the list item. This attribute is used only when ParentType is ListItem.
||It needs PropertyBagParentTypeDefinition enumeration such as ListItem, Files, Folders, or Web. Specify the kind of object to which the property bag belongs.
||Optional TRUE or FALSE. This attribute is not only used with any other ParentType value. It indicates whether the parent object must be the site collection’s top-level site when the ParentType attribute is Web.
||It is also an optional text. This Url attribute specifies the site-relative URL of the list, not only the list items.
How to use & add property Bag in SharePoint 2013?
If your SharePoint utility uses any particular setting for each and individual SharePoint object, such as Web Application, Site Collection, Site, etc. Then, you have to maintain those entries in the configuration files. Here, we will discuss a situation where SharePoint property bags can be a great helper.
There is no any particular out-of-box user interface available to manage property bag settings in SharePoint 2103. Thus, we use object model codes to set or get the properties programmatically. There is an option available in SharePoint designer to set/get the property bag settings.
- First of all, go to the Site >> Site Settings.
- Then, click on the Parameters tab.
- Now, you will be able to manipulate all of your custom property bag values.
The Bottom Line
In this blog, we have discussed what are property bags in SharePoint 2013 and their benefits. In this current era, every organization wants to store their meta-data information in key-value pairs. In this situation, Property Bag in SharePoint 2013 is very beneficial for users.