Warning: Declaration of WarpMenuWalker::start_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = Array) in /home4/x15denis/public_html/wp-content/themes/yoo_nano2_wp/warp/systems/wordpress/helpers/system.php on line 678

Warning: Declaration of WarpMenuWalker::end_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::end_lvl(&$output, $depth = 0, $args = Array) in /home4/x15denis/public_html/wp-content/themes/yoo_nano2_wp/warp/systems/wordpress/helpers/system.php on line 678

Warning: Declaration of WarpMenuWalker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) in /home4/x15denis/public_html/wp-content/themes/yoo_nano2_wp/warp/systems/wordpress/helpers/system.php on line 678

Warning: Declaration of WarpMenuWalker::end_el(&$output, $item, $depth) should be compatible with Walker_Nav_Menu::end_el(&$output, $item, $depth = 0, $args = Array) in /home4/x15denis/public_html/wp-content/themes/yoo_nano2_wp/warp/systems/wordpress/helpers/system.php on line 678
Denis Stadler – SharePoint & Dynamics CRM Consultant » SharePoint Property Bag

Posts Tagged ‘SharePoint Property Bag’

How to Save Configuration Data in SharePoint Development

Written by Denis Stadler on . Posted in Custom Development

When we develop custom application over the SharePoint platform, often we need to store different configuration parameters as: connection strings, e-mail addresses, URLs or different data parameters.

In SharePoint we have the following possibilities to store the configuration data (I will enumerate them based on my preference):

SharePoint Property Bag

This can be used for all the custom SharePoint solutions (Farm, Web Application, Site Collection, Web). The only disadvantage that I found is the fact that you have to build an application page or a web part to manage this items, because there is no interface provided by default.

What I wanted to share in this article were the get/set (load/save) methods that I use to access the Property Bag in my custom solutions. Usually I create a public static class called Helpers, where I store all the common methods needed in a solution. To load and save the Property Bag data I created a LoadProperty and a SaveProperty method with two overloads each.

In case we call this method from a FeatureActivated event, we need the second overload. In this case the object SPContext.Current.Web does not exist. Anyway you can find below the code that I used:

#region Load Configuration Property
public static string LoadProperty(string strKeyName)
{
string strResult = string.Empty;

SPWeb webCurrent = SPContext.Current.Web;

if (webCurrent.Properties.ContainsKey(strKeyName))
{
strResult = webCurrent.Properties[strKeyName].ToString();
}
return strResult;
}

public static string LoadProperty(SPWeb webCurrent, 
string strKeyName)
{
string strResult = string.Empty;

if (webCurrent.Properties.ContainsKey(strKeyName))
{
strResult = webCurrent.Properties[strKeyName].ToString();
}
return strResult;
}
#endregion

Warning: Parameter 1 to W3_Plugin_TotalCache::ob_callback() expected to be a reference, value given in /home4/x15denis/public_html/wp-includes/functions.php on line 3208