In my last article, we looked at how you can programmatically add a new instance of a Document Set into a library. The document set we used was an out-of-the-box SharePoint document set content type.
One of the few benefits of using a document set in SharePoint – is the ability to create a set of documents with few initial files in it. In a way, you can have the document set containing an initial package of files which further can be modified.
Let’s take a look at what’s involved in the process and how the end result looks like. First, we’re going to create a new document set content type with our pre-defined set of files:
1. Navigate to the home page of your team site, in my case http://intranet.contoso.com and ensure the document set feature is enabled on the site. Click Site Actions -> Site Settings -> Site collection features. Ensure the Document Sets is enabled.
2. Now, let’s create a new document set content type. Click Site Actions -> Site Settings -> Site content types
3. Click the Create link and fill out the details of the document set as shown below:
4. Click OK to create a new content type.
5. You will be taken to the content type detail page. In here you can specify additional metadata which is going to be available on the document set. The metadata here will have exactly the same properties as metadata in document libraries. Click Document Set Settings to define the initial set of files the instance of document set will contain.
6. Under default content as shown below specify the default files which are going to be a part of the document set.
7. Click OK.
Now, let’s associate our document set content type to one of the libraries on your site. In my case it’ll be Shared Documents.
1. In the Library Settings for your library, under advanced settings, ensure you have selected Yes to Allow management of content types?
2. Now, add the content type to the library:
That’s it, now our custom document set content type is associated to the library.
When you create a new document set instance - you will see two default documents created in the in each instance of the document set, these are files we added as our initial content.
Enjoy!





