Creating and Customizing Document Sets in SharePoint Server 2010
Summary: Learn how to create SharePoint Server 2010 document sets by using Visual Studio 2010 instead of by using the browser-based user interface.
Applies to: SharePoint Foundation 2010 | SharePoint Server 2010 | Visual Studio | Visual Studio 2008 | Visual Studio 2010
Provided by: Andrew Connell, Critical Path Training, LLC (SharePoint MVP)
Document sets, introduced in Microsoft SharePoint Server 2010, enable users to create a composite item that consists of properties and child documents. This enables customers to associate multiple documents with a single work item and wrap them into a single version or workflow. The SharePoint browser-based user interface (UI) makes it easy to create document sets. However, developers may want to create document sets by using Microsoft Visual Studio 2010 and package them in portable and reusable solution packages (.wsp files). This Visual How To demonstrates how to create a custom document set by using the SharePoint development tools in Microsoft Visual Studio 2010.
Creating custom Microsoft SharePoint 2010 document sets by using the browser-based UI is fairly intuitive. However, this work can become more complicated when you are creating them by using SharePoint Features. Document Sets can be created by using new additions to the SharePoint object model, but SharePoint Features provide the most reusability and portability when they are deployed by using SharePoint solution packages.
Creating Supporting Content Types
There are a few aspects about document sets that are important to understand. A document set can contain fields just as traditional content types can. Document Sets also contain content types that define the child items that reside within the document set. When the document set and child content types share the same fields, these fields can be flagged as shared fields. When a field is flagged as a shared field, it is updated in all child content types when the parent field in the document set is updated. Defining content types within a Feature for use within a document set is made easier by using the SharePoint development tools in Visual Studio 2010. The following markup creates a content type and provisions a default template.
Creating the Custom Document Set Welcome Page
Document sets appear in document libraries as single list items with a specific icon. When the user selects a document set, the document set's welcome page appears. This Web Parts page is used to show the document set's properties and all the contents in the set. As with any Web Parts page, this page is customizable. To customize it, create a custom file named DocSetHomePage.aspx, and then copy it to the top level (root) of the content type folder when it is provisioned into SharePoint. The root folder is usually _cts/content type name, but is defined in the content type, as shown in the following markup.
Specifying Shared Fields, Allowed Content Types, Welcome Page Fields, and Default Documents
The definition of a document set within a Feature can contain additional settings. These are all declared by using the <XmlDocuments> section in the content type definition. Each of these sections uses a specific XML namespace. For readability, the following markup has been trimmed from the code sample that is associated with this Visual How To.
Document sets in SharePoint Server 2010 enable users to incorporate real-world processes. With document sets, users can compile multiple work items into a single work product. Although each work item can have its own version, workflow, and metadata, the entire document set can have a single version, workflow, metadata, and permissions applied to it. This gives users the most flexibility to incorporate their day-to-day work into SharePoint, enabling SharePoint to provide the most value and productivity for users.
> [!VIDEO https://www.microsoft.com/en-us/videoplayer/embed/72c1200c-d118-4cf2-868c-1ceb02670831]
About the Author
MVP Andrew Connell is an author, instructor, and co-founder of Critical Path Training, a SharePoint education-focused company. Andrew is a six-time recipient of Microsoft’s Most Valuable Professional (MVP) award (2005-2010) for Microsoft Content Management Server (MCMS) and Microsoft SharePoint Server. He authored and contributed to numerous MCMS and SharePoint books over the years including his book Professional SharePoint 2007 Web Content Management Development by WROX. Andrew speaks about SharePoint development and WCM at conferences such as Tech-Ed, SharePoint Connections, VSLive, SharePoint Best Practice Conference, SharePoint Evolutions Conference, Office Developer Conference, and Microsoft SharePoint Conference in the United States, Australia, England, and Spain. Andrew blogs at Andrew Connell Blog and on Twitter @andrewconnell.