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();

Advertisements

4 Responses to Programmatically Update List Content in SharePoint

  1. Arfan says:

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

  2. DonCarnage says:

    SPListItem[“FullName”] = FullName; –> Wrong

    ListItem[“FullName”] = FullName; –> Correct

    Best regards

  3. skhumbuzo mjoji says:

    thank you guys…
    and special thanks to DonCarnage…

  4. Elena says:

    For many regions, the entire rpm distributed free of charge STB The costs have been overwhelmed, and then implementation
    of the Reconstruction of two-way network, the funding is clearly beyond its capability.
    This is true simulation of the traditional transmission of radio and
    television programs, as it is only a station house music on your PC.
    With 75 plus musical channels on the bandwidth, you
    cannot stay out of music in any point of time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: