Partilhar via


SPListItem.Item Property (Int32)

Gets or sets the value that is contained by the field at the specified index in the field collection of the parent list.

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

Syntax

'Declaration
Public Overrides Property Item ( _
    index As Integer _
) As Object
    Get
    Set
'Usage
Dim instance As SPListItem
Dim index As Integer
Dim value As Object

value = instance.Item(index)

instance.Item(index) = value
public override Object this[
    int index
] { get; set; }

Parameters

  • index
    Type: System.Int32

    A 32-bit integer that specifies the index of the field in the parent list.

Property Value

Type: System.Object
An object that contains the field value.

Exceptions

Exception Condition
ArgumentOutOfRangeException

The specified index is outside the valid range of indices for the collection.

Remarks

For information about the field types that are used in SharePoint Foundation and how they relate to .NET types, see the SPListItem class.

Important

To improve performance and optimize the number of SQL Server queries that SharePoint Foundation must execute, use the GetItems method of the SPList class to retrieve items that are based on the value of their fields. The GetItems method allows you to specify search criteria by passing a Collaborative Application Markup Language (CAML) query through the SPQuery or SPView class. In addition, list performance may be compromised if a list contains an unnecessarily large number of fields.

See Also

Reference

SPListItem Class

SPListItem Members

Item Overload

Microsoft.SharePoint Namespace