Add views column in MOSS?
July 27, 2009 6:53 AM   Subscribe

microsoftfilter: Using MOSS, how can I add a column to a discussion board list to show the number of times an item has been viewed?

Currently have #of replies, but also want to show # of views for each item. Seems like this should be easy, but I have dug around and don't see this option.

posted by smelvis to Computers & Internet (2 answers total)
My first thought was to create an Event Receiver that updates the view count on Item Open. you have probably already found, it seems that you can't trigger an Event Receiver on an open or read event.

The only way I can think to do it is to build a pair of custom Web Parts that are used to display the item. Each time the user views the item, the web part could update the count at the same time.

You'd actually need 2 web parts to make this work. The first would show a list of available items that the user could click on to view. Basically you'd be recreating the built-in List Web Parts that ship with Sharepoint. The links that this web part would display would all point to a page containing the second web part, with the item # of the desired entry in the URL. All your links would looks something like: http://server/site/webpart2page.aspx?Item#=00001

When a user clicked on a link, it would open the page that contains your second web part. The second web part would read in the URL used to open the page and pull the Item # from the URL. It would then open the item for display and add to the view count.

This will work as long as you can force your users to only open items via your custom web parts. If they can get directly to the list, their views won't be counted.
posted by Eddie Mars at 11:37 AM on July 27, 2009

A couple ways come to mind:

- read/query the IIS logs (LogParser/PAL)
- enable auditing and then get the audit details
posted by jkaczor at 11:03 PM on July 27, 2009

« Older Do Mormons make better employees?   |   How do I properly sync Outlook with Google? Newer »
This thread is closed to new comments.