Wednesday 16 January 2013

Create sharepoint document library programatically

This is how we can craete document library programatically.


             SPSite site = new SPSite("URL");
             SPWeb web = site.OpenWeb();
             web.AllowUnsafeUpdates = true;
             web.Lists.Add("Document Programmatically", "Doc programmatically", SPListTemplateType.DocumentLibrary);
             web.AllowUnsafeUpdates = false;
             web.Dispose();
             site.Dispose();

-------------------
Run this by creating console application.

No comments:

Post a Comment