Blog

Custom Document Set Features in SharePoint 2010


by Tobias Lekman, 04 May, 2011

Introduction

During a project we found that packaging custom document sets in SharePoint was not as straight-forward as we thought. In this post, I will share lessons learned and solutions for packaging and deploying custom document sets.

About Document Sets

“Document Sets is a new feature in SharePoint Server 2010 that enables an organization to manage a single deliverable, or work product, which can include multiple documents or files. A Document Set is a special kind of folder that combines unique Document Set attributes, the attributes and behavior of folders and documents, and provides a user interface (UI), metadata, and object model elements to help manage all aspects of the work product.

Document Sets planning (SharePoint Server 2010) (TechNet): http://technet.microsoft.com/en-us/library/ff603637.aspx

The Issue

When creating a new document set and customizing the document set properties, these work well in SharePoint but are hard to package and export.

Steps:

  1. Activate the Document Sets site collection feature
  2. Create a new document type that inherits the Document Set content type
  3. Customize the document set properties

Create and manage document sets (Microsoft): http://office.microsoft.com/en-us/sharepoint-server-help/create-and-manage-document-sets-HA101782480.aspx

You can try to export the document set as:

  • Exporting a list using the content type as a list template
  • Save the site as a sandboxed site template solution
  • Import the content type using Server Explorer in Visual Studio

None of the solutions will allow us to control the document property settings. On top of that, importing the content type in Visual Studio does not even generate XML that is valid according to the schema.

The Solution

  • First of all, we will import the Content Type ID into a new Content Type module in Visual Studio
  • Then, we customize the XML for the document set content type.
  • Last, we add a custom version of the feature event handler that provisions the document set welcome page

The issue is that, inheriting directly from this code, the web parts on the welcome page will be provisioned each time the feature is activated, making upgrades a tad hard. Also, when the feature deactivates a check is made to see if the document set content type is in use and then cancels the deactivation process. This is not what we want to do.

I have posted the solution on MSDN Snippets Gallery instead of adding all the source code in this post.

image

Provisioning Event Handler for Custom Document Set Features in SharePoint 2010 (MSDN Code Snippets) http://code.msdn.microsoft.com/Custom-Document-Set-eb3fbcfd