Blogger :
Evgeny Tugarev
All posts :
All posts by Evgeny Tugarev
Category :
XML
Blogged date : 2008 Jul 09
In the top-level SharePoint list views I often order items by the "Last Updated" column. Corresponding xml fragment of the list schema.xml looks like
<View BaseViewID="0" Type="HTML" ContentTypeID="0x012001">......
<Query>
<OrderBy>
<FieldRef Name="DiscussionLastUpdated" Ascending="FALSE">
</FieldRef>
</OrderBy>
</Query>
</View>
When a SPList contains large number of items it is also vital to define "Last Updated" as indexed column to keep having good performance. Go up to the field definitions and add Indexed="TRUE" property to the "Last Updated" field.
<Field ID="{59956c56-30dd-4cb1-bf12-ef693b42679c}" Name="DiscussionLastUpdated" DisplaceOnUpgrade="TRUE" ... Indexed="TRUE">
And don't forget to rebuild you .wsp if you have one 
Cheers,
Evgeny Tugarev
