SPListConfiguration Feature

Rating: No reviews yet
Downloads: 72
Released: Jul 4, 2010
Updated: Jul 4, 2010 by sharepointholic
Dev status: Stable Help Icon

Recommended Download

Application SPListConfigurationFeatureReceiver_SP2007
application, 4K, uploaded Jul 4, 2010 - 45 downloads

Other Available Downloads

Source Code SPListConfigurationFeature_SP2007_VS2008
source code, 444K, uploaded Jul 4, 2010 - 27 downloads

Release Notes

SPListConfiguration is a SharePoint feature that developers can use to configure their SharePoint lists using XML and without the need of writing .NET code.

SPListConfiguration can be used for many different purposes. For example, you can use it to set most of the properties for the SPList object that references your list or to stop inheriting permissions from the parent web. You can even use it to add properties to the property bag of the list root folder.

For configuring a list using SPListConfiguration, you should specify the list name in the preoperty Key and the
desired configuration settings in the property value as shown below :

<Properties>
<Property Key="Calendar" Value="Hidden,true;EnableVersioning,false;AddToPropertyBag,MyKey:MyValue"/>
<Property Key="Tasks" Value="BreakRoleInheritance,false;ReadSecurity,2"/>
</Properties>

The previous XML does the following on your behalf :
SPList.Hidden = true;
SPList.EnableVersioning= false;
SPList.BreakRoleInheritance(false);
SPList.ReadSecurity = 2;
And it also adds a property of name "MyKey" and value "MyValue" to the property bag of the SPlist root folder

Neat, eh ? It's all about Reflection :)


SPListConfiguration can be used in two ways

1) From a site definition; in the <WebFeatures> element.

<WebFeatures>
<Feature ID="9697591b-c325-43e8-bf2f-3c33e05c59b4">
<Properties>
<Property Key="Calendar" Value="Hidden,true;EnableVersioning,false;AddToPropertyBag,MyKey:MyValue"/>
<Property Key="Tasks" Value="BreakRoleInheritance,false;ReadSecurity,2"/>
</Properties>
</Feature>
</WebFeatures>


2) Since the key component of this feature is its feature receiver which performs all the heavy lifting, you can only use the feature receiver assembly and hook it up as a receiver for your features. I have included the assembly as a separate download as well.

<Feature Id="ID of Your Feature"
Title="Countries List"
Description="A list that contains all the countries of the world"
Hidden="FALSE"
Scope="Web"
ReceiverAssembly="SPListConfigurationFeature, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=064ae22bb48e8f1b"
ReceiverClass="SPListConfigurationFeature.SPListConfigurationFeature"
xmlns="http://schemas.microsoft.com/sharepoint/">

<ElementManifests>
<!-- The countries List is created here -->
<ElementManifest Location="elements.xml"/>
</ElementManifests>

<Properties>
<!-- The countries List is configured here -->
<Property Key="Countries" Value="Hidden,true;BreakRoleInheritance,false"/>
</Properties>

</Feature>

Also keep in mind that you set any list properties of type String, Boolean or Int32 and this covers almost 95% of the available properties.

Reviews for this release

No reviews yet for this release.