How to: Create a New Document Set Form in SharePoint Server 2010 (ECM)

Applies to: SharePoint Server 2010

Microsoft SharePoint Server 2010 includes a new form that is used to create document sets. The form is located in the _layouts folder; there is one form that all document set content types use. With a custom form, you can automatically fill in metadata or include conditional formatting so that only certain fields appear, depending on what options a user selects.

The document set content type includes a property called NewFormUrl. Changing this property lets you specify one new form for each document set content type. Before changing this property, create a new .aspx form and store it in the _layouts folder, or in a folder in _layouts. If you store the form inside a folder, you must add a web.config file that includes information about the document set assembly. The document set object model requires the web.config file to create a document set.


To create a document set form

  1. Create an.aspx form and store it in the _layouts folder, or in a folder in _layouts.


    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="CustomNewDocset.aspx.cs" Inherits="_Default" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <head runat="server">
        <asp:Literal ID="litList" runat="server" />
        <asp:Literal ID="litCt" runat="server" />

    Code-behind page

    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Microsoft.SharePoint;
    public partial class _Default : System.Web.UI.Page 
        protected void Page_Load(object sender, EventArgs e)
    SPList list = SPContext.Current.List;
    litList.Text = list.Title;
    SPContentTypeId ctid = new SPContentTypeId(Request.QueryString.GetValues("ContentTypeId")[0]);
    SPContentType ct = list.ContentTypes[ctid];
    litCt.Text = ct.Name;
  2. Update the document set content type URL to use the custom new document set page.


    You can use ChangeNewDocSetPage.ps1 to update the document set content type URL. The example script passes in the URL to the site that contains the document set content type to be changed. ctid represents the appropriate content type ID for the content type to be changed. The script updates the NewFormUrl property to use the customized new document set page instead of the default page, and uses parameters as follows. The script creates a custom new document set page and updates the newFormUrl to use the new page. When you use the New Document drop-down list in a document library to create a new document set, the custom page should appear on the list.

    Table 1. ChangeNewDocSetPage.ps1 object reference

    Object Reference



    The location in realtion to the _layouts folder that contains the custom new document set form.


    Content type ID of the document set that is being modified.


    URL that specifies the custom document set content type.


    $siteUrl = "http://mysite"
    $ctid = "0x0120D520"
    $site = New-Object Microsoft.SharePoint.SPSite($siteUrl)
    $web = $site.RootWeb; 
    $contentTypeId = New-Object Microsoft.Sharepoint.SPContentTypeId($ctid)
    $contentType = $web.ContentTypes[$contentTypeId]
    $contentType.NewFormUrl = "_layouts/CustomNewDocset/CustomNewDocset.aspx"
  3. Create a web.config file (required for the new document set content type page) and place it in the folder that contains the custom new document set .aspx page.


    You can skip this step if you added the new document set content type page to the root of _layouts. You can add references to other assemblies as needed.

    Web.Config<?xml version="1.0"?>
    <!--     Note: As an alternative to manually editing this file, you can use the Web admin tool with the ASP.NET Configuration option 
    to configure settings for your application. A full list of settings and comments can be found in 
    machine.config.comments, usually located in \Windows\Microsoft.Net\Framework\v2.x\Config -->
        Set compilation debug="true" to insert debugging
        symbols into the compiled page. Because this
        affects performance, set this value to true only
        during development.        -->
    <compilation debug="false">
    <add assembly="Microsoft.Office.DocumentManagement, Version=, Culture=neutral,PublicKeyToken=94DE0004B6E3FCC5"/>

See Also


Document Sets in SharePoint Server 2010 (ECM)

Developing with Document Management Features in SharePoint Server 2010 (ECM)