Steps
  • Open Visual Studio in your system

  • Select Console Applciation template and give as name .

  • Add a Microsoft.Cleint Assembly refrence file in right side refrence tab in visual studio.

  • 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");
  15. // Get the SharePoint web
  16. Web web = clientContext.Web;
  17. // Get the SharePoint list by title
  18. List list = web.Lists.GetByTitle("TestLibrary");
  19. // Enable force check out for document library
  20. list.ForceCheckout = true;
  21. list.Update();
  22. clientContext.ExecuteQuery();
  23. }
  24. }
  25. }
Hit F5 and check the output.
Thanks for reading my blogs.