Programmatically Update List Content in SharePoint

The Below is the Sample Code to update the Sharepoint list content programmatically by using SharePoint Object Model.

SPSite Site = new SPSite(“http://localhost:21000″);
SPWeb Web = Site.OpenWeb();
SPList List = Web.Lists["Address Book"];
SPListItem ListItem = List.GetItemById(0);

string FullName = string.Empty;

FullName = ListItem["FirstName"].ToString() + ListItem["LastName"].ToString();
SPListItem["FullName"] = FullName;
ListItem.Update();

One Response to “Programmatically Update List Content in SharePoint”

  1. Arfan Says:

    This needs user name & password. how can we pass user credential through code

Leave a Reply