Geeks With Blogs
Evgeny Tugarev blog

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

Posted on Wednesday, July 9, 2008 10:31 AM | Back to top


Comments on this post: How to define indexed column in SharePoint list in schema.xml file

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Evgeny Tugarev | Powered by: GeeksWithBlogs.net