Compartilhar via


SPFile.GetListItem Method

Gets the SPListItem that corresponds to this file, if this file belongs to a document library. Also gets values for specified fields.

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

Syntax

'Declaration
Public Function GetListItem ( _
    ParamArray fields As String() _
) As SPListItem
'Usage
Dim instance As SPFile
Dim fields As String()
Dim returnValue As SPListItem

returnValue = instance.GetListItem(fields)
public SPListItem GetListItem(
    params string[] fields
)

Parameters

  • fields
    Type: []

    List of fields for which to get values. Sending a blank string causes none of the fields to be fetched. This parameter cannot be a null reference (Nothing in Visual Basic).

Return Value

Type: Microsoft.SharePoint.SPListItem
The list item that contains the file object.

Remarks

This function is equivalent to SPFile.Item except that this version is more efficient because only specified field values are fetched.

See Also

Reference

SPFile Class

SPFile Members

Microsoft.SharePoint Namespace