locked
Adding Color to the Monthly and Weekly Calendar RRS feed

  • Question

  • Is there a way to add color to the Monthly and Weekly Calendar views in MOSS/WSS 3.0? Ideally, we would like to base it on some logic of a field value. Any thoughts would be helpful.
    Tuesday, July 3, 2007 4:30 AM

All replies

  • You can re-use the calendar logic in a custom web part and achieve colorization, but only for all-day events.

    We pulled this off by grabbing the pre-existing calendar's items (SPCalendar.Items) as an SPCalendarItemCollection, and iterated through them. 

    Then we created a new SPCalendarItem based on each existing item, and set the item.BackGroundColorClassName property to reflect the name of a statically mapped .css class based on some custom logic.  Finally, those items were added to a new SPCalendar, and the new calendar rendered.

    Again, the BackGroundColorClassName property only seems to work on all-day events -- but it allowed us to do what we were hoping to do (creating a calendar to color-code our appointments based on type).

    Thursday, July 5, 2007 4:02 PM