In this post we will discuss about how we can create SharePoint list using SharePoint 2013 client object model. In my previous we have discussed how we can delete a SharePoint list using client object model.
First give reference of two DLLs which are needed to work with SharePoint client object model namely: Microsoft.SharePoint.Client.Runtime.dll and Microsoft.SharePoint.Client.dll from the location C:\ProgramFiles\Common Files\Microsoft Shared\web server extensions\15\ISAPI
Below is the full code and in this example we will create a custom Task list.
string siteURL = "http://Your Site URL/";
ClientContext context = new ClientContext(siteURL);
Web web = context.Web;
ListCreationInformation listCreationInfo = new ListCreationInformation();
listCreationInfo.Title = "My Task List";
listCreationInfo.Description = "This is a custom task list !";
listCreationInfo.TemplateType = (int)ListTemplateType.Tasks;
List list = web.Lists.Add(listCreationInfo);
context.ExecuteQuery();
You can also check what are hardware and software requirement for SharePoint 2013.
First give reference of two DLLs which are needed to work with SharePoint client object model namely: Microsoft.SharePoint.Client.Runtime.dll and Microsoft.SharePoint.Client.dll from the location C:\ProgramFiles\Common Files\Microsoft Shared\web server extensions\15\ISAPI
Below is the full code and in this example we will create a custom Task list.
string siteURL = "http://Your Site URL/";
ClientContext context = new ClientContext(siteURL);
Web web = context.Web;
ListCreationInformation listCreationInfo = new ListCreationInformation();
listCreationInfo.Title = "My Task List";
listCreationInfo.Description = "This is a custom task list !";
listCreationInfo.TemplateType = (int)ListTemplateType.Tasks;
List list = web.Lists.Add(listCreationInfo);
context.ExecuteQuery();
You can also check what are hardware and software requirement for SharePoint 2013.