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 file.
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.SharePoint.Client;
- namespace GowthamSamples
- {
- class Program
- {
- static void Main(string[] args)
- {
-
- ClientContext ctx= new ClientContext("http://gauti.sharepoint.com/sites/sp1/");
- / Assume that the web has a list named "Gowtham"
- List announcementsList = ctx.Web.Lists.GetByTitle("Gowtham");
-
-
-
- .
- ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
- ListItem newItem = announcementsList.AddItem(itemCreateInfo);
- newItem["Title"] = "Gowtham's test Item!";
- newItem["Body"] = "Hello C# Corner Users!";
- newItem.Update();
-
- context.ExecuteQuery();
-
- }
- }
- }