ContentIterator.GetAnyListItemInList Method

Gets an arbitrary but consistent SPListItem object from a SPList object.

Namespace:  Microsoft.Office.Server.Utilities
Assembly:  Microsoft.Office.Server (in Microsoft.Office.Server.dll)

Syntax

'Declaration
Public Shared Function GetAnyListItemInList ( _
    list As SPList _
) As SPListItem
'Usage
Dim list As SPList
Dim returnValue As SPListItem

returnValue = ContentIterator.GetAnyListItemInList(list)
public static SPListItem GetAnyListItemInList(
    SPList list
)

Parameters

Return Value

Type: Microsoft.SharePoint.SPListItem
List item, or a null reference (Nothing in Visual Basic) if the list is empty.
An SPListItem object from a SPList object, or a null reference (Nothing in Visual Basic) if the SPList is empty.
Returns SPListItem.

Remarks

This method can be useful if you depend on the LastItemModifiedDate property but need to force that to be updated in cases where you call the [M:Microsoft.SharePoint.SPWeb.Update()] method. Use this method to get an arbitrary item (preferably from a hidden list that is internal to your feature) that you can call SPListItem.Update() that will update the LastItemModifiedDate property.

See Also

Reference

ContentIterator Class

ContentIterator Members

Microsoft.Office.Server.Utilities Namespace