Sort a SPView using code
Long time no blog….
My current project with MOSS requires doing almost everything programmatically, provisioning sites, constructing site navigation, creating lists, applying content types, etc. I spent a little while to figure how to sort a SPView for a document library. Once you know it, it's actually super easy. Just modify the Query property.
Example:
…..
SPView view = list.DefaultView;
view.Query = "<OrderBy><FieldRef Name='Modified' Ascending='FALSE' /></OrderBy>"'
…..
This set the view ordered by the modified date, the newest document at the top. The default order is by document name. Also we can filter the records for this view since it is CAML query string.
This entry was posted
on Tuesday, November 27th, 2007 at 9:00 am and is filed under Uncategorized.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Sort a SPView using code
Long time no blog….
My current project with MOSS requires doing almost everything programmatically, provisioning sites, constructing site navigation, creating lists, applying content types, etc. I spent a little while to figure how to sort a SPView for a document library. Once you know it, it's actually super easy. Just modify the Query property.
Example:
…..
SPView view = list.DefaultView;
view.Query = "<OrderBy><FieldRef Name='Modified' Ascending='FALSE' /></OrderBy>"'
…..
This set the view ordered by the modified date, the newest document at the top. The default order is by document name. Also we can filter the records for this view since it is CAML query string.
This entry was posted
on Tuesday, November 27th, 2007 at 9:00 am and is filed under Uncategorized.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.