Partager via


SPList.GetItemByIdSelectedFields - Méthode

Gets the list item with the specified identifier (ID) and includes only the values for the specified fields.

Espace de noms :  Microsoft.SharePoint
Assembly :  Microsoft.SharePoint (dans Microsoft.SharePoint.dll)

Syntaxe

'Déclaration
Public Function GetItemByIdSelectedFields ( _
    id As Integer, _
    ParamArray fields As String() _
) As SPListItem
'Utilisation
Dim instance As SPList
Dim id As Integer
Dim fields As String()
Dim returnValue As SPListItem

returnValue = instance.GetItemByIdSelectedFields(id, _
    fields)
public SPListItem GetItemByIdSelectedFields(
    int id,
    params string[] fields
)

Paramètres

  • id
    Type : System.Int32

    An ID of the item. The value of this parameter does not correspond to the index of the item within the collection of items for the list, but to the value of the ID property of the list item.

  • fields
    Type : []

    A comma-delimited list of field names for which to get values. To retrieve the value of the ContentType property of the list item, you must also specify the ContentTypeId property of the item. To retrieve all field values, use the GetItemByIdAllFields(Int32) method.

Valeur renvoyée

Type : Microsoft.SharePoint.SPListItem
The list item, including data from the specified fields. If you try to access a field value that is not returned because it was not specified, SharePoint Foundation makes a round trip to the database to retrieve all the item's field values except for User fields or custom Lookup fields.

Exceptions

Exception Condition
ArgumentNullException

fields is null .

Voir aussi

Référence

SPList classe

SPList - Membres

Microsoft.SharePoint - Espace de noms