Add a List Item Programmatically in SharePoint
The below code demonstrates how to use the SharePoint API to add a list items programmatically: string dashListRootStr= “http://sharepointSite/SubSite/Lists/MyList/”; using(SPSite site = new SPSite(dashListRootStr)) { using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists["MySPList"]; SPListItem Item = list.Items.Add(); item["Title"] = txtCompanyName.Text; item["DateReceived"] = System.DateTime.Now; item["Description"] = txtDescription.Text; //Important: Comma and space required to add [...]
Read more



8:19 pm by admin