SPList.AddItem method

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

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

Syntax

'Declaration
Public Function AddItem As SPListItem
'Usage
Dim instance As SPList
Dim returnValue As SPListItem

returnValue = instance.AddItem()
public SPListItem AddItem()

Return value

Type: Microsoft.SharePoint.SPListItem
The new item.

Remarks

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

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

See also

Reference

SPList class

SPList members

AddItem overload

Microsoft.SharePoint namespace

Add()