Create A Task List In SharePoint 2013 Using CSOM

Steps
  1. Open Visual Studio in your system.
  2. Select Console Application template and give the name "Enablefolder".
  3. Add a Microsoft.Cleint Assembly reference file in right side reference tab in Visual Studio.
  4. Replace Program.cs with the source code given below.
Code snippet
  1. using System;  
  2. using Microsoft.SharePoint.Client;  
  3.   
  4.   
  5. namespace GowthamArticles  
  6. {  
  7.     class CreateList  
  8.     {  
  9.         static void Main()  
  10.         {     
  11.               
  12.             ClientContext clientContext = new ClientContext("https://gowtham.sharepoint.com/tutorials");  
  13.             ListCreationInformation creationInfo = new ListCreationInformation();  
  14.             creationInfo.Title = "New TASKList";  
  15.             creationInfo.Description = "THis Task List created PRogrammatically";  
  16.             creationInfo.TemplateType = (int)ListTemplateType.Tasks;  
  17.             web.Lists.Add(creationInfo);     
  18.             context.ExecuteQuery();  
  19.   
  20.   
  21.         }  
  22.     }  
  23. }  
Ebook Download
View all
Learn
View all