Displaying an Archive for a SharePoint List
Say you want to have a SharePoint site that displays all of the items in a list that were created this month, but also have an archive listing, like most blogs do. There’s a neat trick that you can use to make this work.
First, add a column to the items in your list called "Archive Month" and make it a calculated column. For the formula, use:
=TEXT(MONTH([Created])*29,"mmmm") & " " & YEAR([Created])
This will return "September 2007" if the Created date is 9/18/2007. (You could decide to use Modified instead of Created.)
Now, using a Content Query Web Part (CQWP) or a Data View Web Part (DVWP), set up your archive by configuring the Web Part to group by Archive Month and sort by Created. The DVWP will give you much more formatting flexibility but the CQWP will also work.
Several nice things about this approach:
- It’s dynamic, so you won’t see months that don’t have entries.
- You can limit the length of time for the archive, e.g., only the last 12 months.
One Comment