SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a suggestion for a specific development requirement; it is just for a sub-site.

The sub-site has a single list with 20 columns and 850+ items. Now, in the home page, I have to have there webparts for the following purpose.

  1. have to display the recently added items (last - 5)
  2. have to display the most viewed items (top -5 )
  3. have to display the most important items (top – 5)

the list already has the required columns like item importance, view count….

I have the following ideas in my mind.

1. Custom webpart (OOB) which will do a CAML query against the list and will display the information on the webpart (3 webparts)
2. Custom webpart (SharePoint Webservice) which will do a CAML query against the list and will display the information on the webpart (3 webparts)
3. Content Editor webpart, it will call a webservice which will generate the required html code after processing the CAML query (3 webparts).

I do not want to use the CbQ webpart for some reason.

Those webparts should not take more than 2sec to load (mainly writing those webpart to improve the page performance), what is the best option? Or do you have any other suggestion?

share|improve this question
up vote 5 down vote accepted

If the fields are already in the list, then all three of those requirements can be handled by sorting and setting an item limit in three custom views. Why not just create a view for each one then add 3 ListView web parts on the page, each pointing to the appropriate view?

Technically, you don't even have to create the views on the list as you could just create them when defining the web part properties.

share|improve this answer
Dang, Dave beat me to it. – Eric Alexander Apr 27 '11 at 19:28
Ha! Now I can tell my daughter that I beat a pirate today :) That is a lot easier than trying to explain what it is I actually do! – Dave Wise Apr 27 '11 at 19:48
Kudos to you, we aren't easily bested! – Eric Alexander Apr 27 '11 at 20:25
Hmm from where do you get most viewed data? – Anders Rask Apr 27 '11 at 20:50
He said all the figures were manually input into the list, meaning there is nothing to process from any log files. "the list already has the required columns like item importance, view count…." – Eric Alexander Apr 27 '11 at 20:57

Based on what you've said, create 3 views of this list with item limits of 5, displaying the desired data fields.

One should be sorted by created descending. One should be sorted by most viewed descending. One should be sorted by most important descending.

Add 3 list view web parts to the page, each one pointing to a specific view created above. No need for custom programming or anything, default Sharepoint functionality.

share|improve this answer

Where do you plan to fetch "most read" data from"?

You mention it is a list. What kind of lists are you dealing with?

In sp2007 there are no item level auditing (not implemented by design since it proved too heavy on performance) so you would have to "roll your own" data collection, for example with javascript (will only work for pages or list items, not documents).

For data collection SPQuery or SPSiteDataQuery is a good option, but consider implementing HttpRuntime cache of rendered html for performance reasons.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.