Export (0) Print
Expand All

SPListItemCollection.Add Method (String, SPFileSystemObjectType)

Creates an item that uses the specified folder URL and object type but requires the SPListItem.Update method to actually add the item to the list.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

public SPListItem Add(
	string folderUrl,
	SPFileSystemObjectType underlyingObjectType
)

Parameters

folderUrl
Type: System.String

The server-relative URL of the folder where the list item should be created. The URL should begin with a forward slash; for example, /sites/mysite/subweb/Lists/mylist/myfolder.

underlyingObjectType
Type: Microsoft.SharePoint.SPFileSystemObjectType

One of the enumeration values that specifies the type of file system object that the new list item will represent. The only valid types are File and Folder. If you pass another value, an exception is thrown when you call the Update method on the SPListItem object.

Return Value

Type: Microsoft.SharePoint.SPListItem
The new item.
Show:
© 2014 Microsoft