Export (0) Print
Expand All

SPList.AddItem method

Creates a list item in the root folder of the list.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public SPListItem AddItem()

Return value

Type: Microsoft.SharePoint.SPListItem
The new item.

To add an item to a list, first call the AddItem method to create a nonfolder list item with an automatically generated name in the root of the list. Then use indexers on the returned SPListItem object to assign specific values for each field of the item. Finally, call the Update method on the SPListItem object to write the changes to the database.

Important noteImportant

The new item is not actually added to the list until you save it to the content database by calling the SPListItem.Update method.

Show:
© 2014 Microsoft