Getting all lists from the website

Steps
  1. Open Visual Studio in your system
  2. Select Console Applciation template and give as name "GetallList"
  3. Add a Microsoft.Cleint Assembly refrence file in right side refrence tab in visual studio.
  4. Replace Program.cs with the source code below.
  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.   
  8. namespace GetallList  
  9. {  
  10.     class Program  
  11.     {  
  12.         static void Main(string[] args)   
  13.         {  
  14.             // ClientContext - Get the context for the SharePoint Site    
  15.   
  16.   
  17.             ClientContext clientContext = new ClientContext("http://gauti.sharepoint.com/sites/SP");  
  18.   
  19.             // Get the SharePoint web    
  20.   
  21.             Web web = clientContext.Web;  
  22.   
  23.             // Get the SharePoint list collection for the web    
  24.   
  25.             ListCollection listColl = web.Lists;  
  26.   
  27.             // Retrieve the list collection properties    
  28.   
  29.             clientContext.Load(listColl);  
  30.   
  31.   
  32.   
  33.   
  34.             // Execute the query to the server.    
  35.   
  36.             clientContext.ExecuteQuery();  
  37.   
  38.             // Loop through all the list    
  39.   
  40.             foreach(List list in listColl)  
  41.   
  42.             {  
  43.                 // Display the list title and ID    
  44.   
  45.                 Console.WriteLine("List Name: " + list.Title + "; ID: " + list.Id);  
  46.             }  
  47.   
  48.             Console.ReadLine();  
  49.         }  
  50.     }  
  51. }  
Output

Hit F5 and Check the Output. Hope you have enjoyed this.!!! :-)