SPList.Items.Add() v/s SPList.AddItem()

The result of both the methods are same. They both add a new SPListItem to a SharePoint List (SPList) and returns back the newly created item. The difference lies in the process of creating the new items. SPList.Items.Add() explicitly adds a new item to the SharePoint List whereas SPList.AddItem() adds it implicitly.

In order to add a new item, it is required to get the current Lists schema. It is done by calling GetItems. This call takes place internally, so we don’t have any control over it. However, this is where the said two functions differs as they both execute different queries to get their respective ListItems.


In the first case,

var newItem = list.Items.Add();

ListItemCollection is initialized using the following query before creating a new item:

new SPQuery()
    ViewAttributes = "Scope=\"Recursive\""


In this case,

var newItem = list.AddItem();

ListItemCollection is initialized using the following query:

new SPQuery()
    Query = "-1",
    ViewFields = ""

We can clearly see that this is a fake query as it is querying for a ListItem whose ID is -1! It means that the ListItemCollection will always be zero while adding a new item.

This difference gets reflected in the execution time for these queries. Expectedly, the second query, SPList.AddItem(), is much more faster especially while dealing with a List with large number of items.