Adding items to sharepoint list

Sometimes it is required to manage sharepoint lists using C# or webparts. The project, currently I am working requires the same. Add method is available for list(SPList), but there is no way how can I update or save it. After little “google”ing I found it.

SPListItem MyItem = currentList.Items.Add();
MyItem["myfield"] = "Hello World";
MyItem.Update();

Thats it, it will update myfield column with “Hello World”.

No related content found.

This entry was posted in .Net, sharepoint. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>