SharePoint - Create a document set with Workflow - Visual Studio 2010

Asked By Chester Thomas on 30-Jan-12 09:15 AM
Hi,

Does anyone have a working example of how I can create a Document Set in a SharePoint 2010 library using Visual Studio 2010? I need to use Visual Studio as there are parameters I have to pass and SharePoint Designer cannot pick up all that I need.

If you can give me sample code of the .cs file that will be great and I will figure out the rest.

I am pretty much a newbie to dev but very well versed with SharePoint admin.

Thank you in advance.
D Company replied to Chester Thomas on 30-Jan-12 10:26 AM
Hello Chester,

From here you can start ,We can create our own custom document library programmatically, here is the code shown below

SPSite site = SPContext.Current.Site as SPSite;
SPWeb web = site.RootWeb as SPWeb;
try
{/
//Create a new library as the permanent library
Guid customListID = web.Lists.Add("CUSTOM DOCUMENT LIBRARY", "CUSTOM DOCUMENT LIBRARY", SPListTemplateType.DocumentLibrary);
web.Update();
}

let me know if you need more assistance on this!!
regards
D
kalpana aparnathi replied to Chester Thomas on 30-Jan-12 12:20 PM
hi,

here steps for Create a document set with Workflow - Visual Studio 2010

1. create the content types for the document sets and documents.
2. Create the new document library where you want to store your dossiers and link those document sets.
3. Create a list to import the files (we did it from a sql export to excel)
4. Open the site in SPD 2010
5. Create a new workflow on the old items from the list, that starts when a new item is created
6. Add a task to the workflow: create new item on the document library where you are going to store the dossiers
7. Content Type ID from that new item must be the document set you created
8. Add other metadata you want to take with you.
9. Publish the workflow
Chester Thomas replied to kalpana aparnathi on 31-Jan-12 12:34 AM
Thank you for the step by step, am getting somewhere.