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())
{
{
using (SPWeb web = site.OpenWeb())
{
//create the new document set contenttype
SPContentType newDocumentSet = web.ContentTypes.Add (new SPContentType(web.ContentTypes["Document Set"],web.ContentTypes,
“MydocumentSet”));
SPContentType newDocumentSet = web.ContentTypes.Add (new SPContentType(web.ContentTypes["Document Set"],web.ContentTypes,
“MydocumentSet”));
//get a an instance of DocumentSetTemplate for the new document set
DocumentSetTemplate newDocumentSetTemplate = DocumentSetTemplate.GetDocumentSetTemplate(newDocumentSet );
DocumentSetTemplate newDocumentSetTemplate = DocumentSetTemplate.GetDocumentSetTemplate(newDocumentSet );
//add allowable content types
newDocumentSetTemplate.AllowedContentTypes.Add
(web.ContentTypes["Document"].Id);
newDocumentSetTemplate.AllowedContentTypes.Add
(web.ContentTypes["Document"].Id);
//add a shareable property
newDocumentSetTemplate.SharedFields.Add(newDocumentSetContentType.Fields["Module"]);
newDocumentSetTemplate.SharedFields.Add(newDocumentSetContentType.Fields["Module"]);
newDocumentSetTemplate.Update(true);
newDocumentSet .Update();
web.Update();
}
}
}
newDocumentSet .Update();
web.Update();
}
}
}