Tuesday, August 05, 2008

Filtering Calendar List Web Part Entries

Not sure if this is a well known fact, but thought I'd post about it anyway. When you add a web part for a WSS 3.0 Calendar list onto a web part page, the default view automatically filters items to only show those with an end date great than or equal to today, and a start date that is less than 2 years from the current date. The time value is not used for filtering these items.

This means that all current and future events that start within 2 years will be shown.

Also, the description will be truncated after approximately the first 255 characters. Truncation will happen at the end of a word, not half way through one.

If you don't want to show 2 years worth of future events, you can use the following technique to reduce the time span:

  1. Add a new calculated column to your calendar list called Start Advertising.
  2. Set the formula to "=[Start Time] – 60". Change the number of days to whatever you want to use. In this case I'm saying that I want see events that are starting in less than 60 days from now.
  3. Set the data type for the formula result to Date and Time
  4. Update the Calendar web part – Edit the current view
  5. Add a filter for the Start Advertising field "is less than" [today]