次の方法で共有


SPListItem.Item property (String)

Gets or sets a field value in the item based on the field’s title, internal name, or static name.

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

Syntax

'Declaration
Public Overrides Default Property Item ( _
    fieldName As String _
) As Object
    Get
    Set
'Usage
Dim instance As SPListItem
Dim fieldName As String
Dim value As Object

value = instance(fieldName)

instance(fieldName) = value
public override Object this[
    string fieldName
] { get; set; }

Parameters

  • fieldName
    Type: System.String

    A string that contains the title, internal name, or static name of the field.

Property value

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

Exceptions

Exception Condition
ArgumentException

The field does not exist.

Remarks

The Item property is an indexer for the SPListItem class.

The runtime will search first through the internal names of the list item’s fields for the specified string before searching the display names.

For information about the field types that are used in SharePoint Foundation and how they relate to .NET Framework 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 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