Share via


SPListItemCollection.Add method (String, SPFileSystemObjectType, String)

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

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

Syntax

'Declaration
Public Function Add ( _
    folderUrl As String, _
    underlyingObjectType As SPFileSystemObjectType, _
    leafName As String _
) As SPListItem
'Usage
Dim instance As SPListItemCollection
Dim folderUrl As String
Dim underlyingObjectType As SPFileSystemObjectType
Dim leafName As String
Dim returnValue As SPListItem

returnValue = instance.Add(folderUrl, _
    underlyingObjectType, leafName)
public SPListItem Add(
    string folderUrl,
    SPFileSystemObjectType underlyingObjectType,
    string leafName
)

Parameters

  • folderUrl
    Type: System.String

    The server-relative URL of the folder, beginning with a forward slash; for example, /sites/mysite/subweb/Lists/mylist/myfolder.

  • leafName
    Type: System.String

    The file name, including the file extension; for example, mydoc.doc. For more information, see the Name property.

Return value

Type: Microsoft.SharePoint.SPListItem
The new item.

See also

Reference

SPListItemCollection class

SPListItemCollection members

Add overload

Microsoft.SharePoint namespace