Programatically creating document sets in SharePoint 2010

You can create a document set using sharePoint object model, SharePoint Client OM and also using SharePoint 2010 web services.
This example shows how to create document sets using SharePoint object model.
public static void CreateDocumentSetContentType(string libraryUrl)
using (SPSite site = new SPSite(libraryUrl))
using (SPWeb web = site.OpenWeb())
//create the new document set contenttype
SPContentType newDocumentSet = web.ContentTypes.Add (new SPContentType(web.ContentTypes["Document Set"],web.ContentTypes,
//get a an instance of DocumentSetTemplate for the new document set
DocumentSetTemplate newDocumentSetTemplate = DocumentSetTemplate.GetDocumentSetTemplate(newDocumentSet );
//add allowable content types
//add a shareable property
newDocumentSet .Update();

Popular posts from this blog

Custom Form Base Login Web Part With Sharepoint 2010

Real World Branding with SharePoint 2010 Publishing Sites