How to get the count of sites followed by the user

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.             /Pass the credentials for whom we need to get the count of followed    
  20. documents    
  21. / / By  
  22.             default It will take current user who runs this application - Here it  
  23.             will take Administrator because the application is running with that account  
  24.   
  25.             clientContext.Credentials = new NetworkCredential("Gowtham""paswword5""SP2013");  
  26.   
  27.             // Get the SocialFollowingManager instance    
  28.             // Provides methods for managing a user's list of followed actors (users,documents, sites, and tags)    
  29.   
  30.             SocialFollowingManager followingManager = new SocialFollowingManager(clientContext);  
  31.   
  32.             // Get the count of followed documents    
  33.   
  34.             ClientResult < int > followingCount = followingManager.GetFollowedCount(SocialActorTypes.Sites);  
  35.   
  36.             // Execute the query to the server    
  37.   
  38.             clientContext.ExecuteQuery();  
  39.   
  40.             // Display the count of followed documents    
  41.   
  42.             Console.WriteLine("Count of followed documents: " + followingCount.Value);  
  43.             Console.ReadLine();  
  44.         }  
  45.     }  
  46. }  
Output

Hit F5 and Check the Output.

Hope you have enjoyed this.!!:-)
 
 
***********************100 Blogs in SharePoint *********************
I have reached 100 blogs in SharePoint .Thanks to C# Corner Team for encouraged me.And thanks to everyone those who all are supported me.