How to delete a list view in Sharepoint 2013 using CSOM

Steps

  1. Open Visual Studio in your system.
  2. Select Console Applciation template and give as name .
  3. Add a Microsoft.Cleint Assembly refrence file in right side refrence tab in visual studio.
  4. Replace Program.cs with the source code.
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6. using Microsoft.SharePoint.Client;  
  7. namespace CSOMCodeSamples   
  8. {  
  9.     class Program   
  10.     {  
  11.         static void Main(string[] args)   
  12.         {  
  13.             // ClientContext - Get the context for the SharePoint Site    
  14.             ClientContext clientContext = new ClientContext("http://gauti.sharepoint.com/sites/gp/");  
  15.             // Get the SharePoint web    
  16.             Web web = clientContext.Web;  
  17.             // Get the list by Title    
  18.             List list = web.Lists.GetByTitle("CustomList");  
  19.             // Get the specific view by Title    
  20.             View view = list.Views.GetByTitle("gvrView");  
  21.             // Delete the list view    
  22.             view.DeleteObject();  
  23.             // Execute the query to the server    
  24.             clientContext.ExecuteQuery();  
  25.         }  
  26.     }  
  27. }  

Output

Hit F5 and check the output .
Thanks for reading my blogs.

Ebook Download
View all
Learn
View all