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.
  1. using System;
  2. using Microsoft.SharePoint.Client;
  3. namespace GowthamArticles
  4. {
  5. class CreateListItem
  6. {
  7. static void Main()
  8. {
  9. ClientContext clientContext = new ClientContext("https://gowtham.sharepoint.com/tutorials");
  10. List oList = clientContext.Web.Lists.GetByTitle("Announcements");
  11. ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
  12. ListItem oListItem = oList.AddItem(itemCreateInfo);
  13. oListItem["Title"] = "Test Item!";
  14. oListItem["Body"] = "This sample item created programmatically";
  15. oListItem.Update();
  16. clientContext.ExecuteQuery();
  17. }
  18. }
  19. }
Thanks for reading this blog.