Out-of-box- Add an item to a list:
Using C#(Client object model):
Add Item Programmatically to SharePoint List using CSOM.
SharePoint Web Services (jQuery):
Add a new item list. The jQuery Ajax function is used to POST the data to the Lists.asmx web service.
SharePoint REST API:
SharePoint REST API and JQuery to Create SharePoint list item.
Reference to latest jquery.min.js.
SharePoint PowerShell:
Adding list items using PowerShell SharePoint.
Final result shows all the Added Items:
- Navigate to the site containing the list for which you want to add an item.
- Select Settings > Site contents and then in the appropriate list section, select the name of the list.
- Select the Items tab, and then in the New group select New Item.
- Select Save.
Using C#(server object model): Add Item programmatically to SharePoint List using C#.
- //Step to Add new list item programmatically to SharePoint List using C#
- using(SPSite site = new SPSite(SPContext.Current.Site.Url))
- {
- Using(SPWeb web = site.OpenWeb())
- {
- SPList list = web.Lists["DemoList"];
- SPListItem item = list.Items.Add();
- item["Title"] = "using C# :Add new list item programmatically";
- item.Update();
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.SharePoint;
- using Microsoft.SharePoint.Client;
- namespace CreateListItem
- {
- class Program
- {
- static void Main(string[] args)
- {
- string siteUrl = "http://servername:2525/";
- ClientContext clientContext = new ClientContext(siteUrl);
- List oList = clientContext.Web.Lists.GetByTitle("DemoList");
- ListItemCreationInformation listCreationInformation = new ListItemCreationInformation();
- ListItem oListItem = oList.AddItem(listCreationInformation);
- oListItem["Title"] = "Add item in SharePoint List using CSOM";
- oListItem.Update();
- clientContext.ExecuteQuery();
- }
- }
- }
Reference to latest jquery.min.js.
- #Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets
- Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
- #Variables that we are going to use for list editing
- $webURL = "http://yoursiteName"
- $listName = "Demo List"
- #Get the SPWeb object and save it to a variable
- $web = Get-SPWeb $webURL
- #Get the SPList object to retrieve the "Demo List"
- $list = $web.Lists[$listName]
- #Create a new item
- $newItem = $list.Items.Add()
- #Add properties to this list item
- $newItem["Title"] = "Add item in sharepoint List Using SharePoint PowerShell"
- #Update the object so it gets saved to the list
- $newItem.Update()