using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace creatingDocumentLibrary
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://a3599m1d/"))
{
using (SPWeb web = site.OpenWeb())
{
SPListTemplate listTemplate = web.ListTemplates["Document Library"];
SPDocTemplate docTemplate = (from SPDocTemplate dt in web.DocTemplates where dt.Type == 121 select dt).FirstOrDefault();
Guid guid = web.Lists.Add("My Docs", "My Documents", listTemplate, docTemplate);
SPDocumentLibrary library = web.Lists[guid] as SPDocumentLibrary;
library.OnQuickLaunch = true;
library.Update();
Console.WriteLine("Library created successfully");
Console.Read();
}
}
}
}
}
Document Templates :
Following are the SharePoint 2010 document templates available:
Template ID
|
Description
|
100
|
No Template
|
101
|
Word 2003 document
|
103
|
Excel 2003 document
|
104
|
PowerPoint 2003 document
|
121
|
Word document
|
122
|
Excel document
|
123
|
PowerPoint document
|
111
|
OneNote Notebook
|
102
|
SharePoint Designer HTML document
|
105
|
ASPX Web Page
|
106
|
ASPX Web Part Page
|
1000
|
InfoPath document
|
No comments:
Post a Comment