Sunday, 18 November 2007

Updated colour (color) calendar for SharePoint 2007

This article has also been superceded by an updated V2 version which be found here.



I have finished the new version of the SharePoint 2007 colour calendar. Here are some of the features:-

- Built as a SharePoint solution.
- New web part to do the colour coding, no messing with Javascript.
- New type of list to define the colour mappings so you can have one central place to hold colour mappings.
- Works with WSS or MOSS.
- Foreground and background colouring.

There is a new type of list called Colour Calendar and another type of list called Colour Calendar Mapping. An instance of the mapping list is created by default in the root of the site collection with colour mappings for the default event categories.

This mapping list defines the foreground and background colours of each event category.

The colour calendar list is based on the in built calendar list but has two fields added, the event category plus a calculated field needed to make the colouring work.

Having created a colour calendar you need to edit the calendar.aspx page view and add a "PlanetWilson Calendar Colour Coder" web part (snappy title eh?). This should be placed below the calendar view list view webpart.

You should now have a colour coded calendar.

By default the web part gets its colour mappings from the central mapping list deployed at the site collection root. It does however specify a property to point it at a different mapping list should you want some different categories and colours for a calendar. Just create a mapping list somewhere else and set the property to the list, it can be fully qualified URL or relative, don't put the view part on the end of this URL e..g

http://mwmoss/test/mappinglist2

or

./mappinglist2

The categories are held in a site column call Event category, you can change this to add new categories or change existing ones. Be aware though that if you choose the option to push changes down to all the lists you may overwrite any custom categories you made on an individual calendar.

Anyway I hope it is an improvement on the previous version. The source code and WSP file can be found here:-

http://www.codeplex.com/planetwilson


Are you having problems getting it to work?
1) Did you create an instance of the Colour Calendar and NOT the standard calendar list?
2) Did you edit the calendar.aspx page or the page where you have placed a web part for this newly created list and added a "PlanetWilson Calendar Colour Coder" web part? Is it definitely placed AFTER the calendar list view web part?

Thanks to my good buddy Chris (http://chrissyblanco.blogspot.com) for pointing out when I was being stupid banging my head against a brick wall with calculated fields (turns out you definitely need theResultType attribute - doh!)

66 comments:

Paul Galivn said...

This looks very nice. Thanks for sharing!

Anonymous said...

This has a lot of promise. I noticed, however, that I am not able to add e-mail settings for the list. We like to e-mail most of our appointments out. If that could be added, then would there be a way to have it color code events that were e-mailed to it??
Thanks!

Anonymous said...

One more comment... I noticed that it doesn't color code the entries if I view it in list view as opposed to the full calendar view...

Mark Wilson said...

It is based on the original calendar list which also has no email functionality. I am not sure I understand how you would like it to work?

Mark Wilson said...

It was originally designed to only colour code the calendar view. I might look at the list views but I am not sure how much call there would be for it.

Anonymous said...

This looks great!
I'm in the process of trying to colour a calendar that holds absences but I just can't figure out how I get your solution to look at my 'Absence Type' column to find out what colour it should be?!

Mark Wilson said...

I am not sure I follow, where are the absences? You can change event category on the calendar itself to hold the absence types. Create a new mapping list and change the event category on there to hold absence types too. Then make the colour coding web part point to the new mapping list. If this doesn't make sense feel free to email me.

Glenn Thibeault said...

Mark,
Excuse me for being a dope, but I just can't seem to get this color calendar to work. I installed via the bat file, created a new calendar with the "color calendar" list and added the "Calendar Colour Coder" to the page below the color calendar.

The only part I can think I may have gone wrong is on the following directions:

Having created a colour calendar you need to edit the calendar.aspx page view and add a "PlanetWilson Calendar Colour Coder" web part (snappy title eh?). This should be placed below the calendar view list view webpart.

I assume this ment to just add the "PlanetWilson Calendar Colour Coder" web part to the color calendar page I created via the normal edit page method. But now I am wondering if I need to edit the "aspx" page directly or something. The "color coder" webpart shows up under the color calendar on the page which seems a little wierd to me, I would think it should be invisible.
As you can tell I am not that versed with WSS 3.0 and any help would be appreciated.This is a great webpart and would like to get it working. Thanks for the great work


Glenn Thibeault
gthibeault@onsiteit.us

Mark Wilson said...

Can you email me the source for the page and a screenshot of what you currently have?
Email me at blog@planetwilson.co.uk

Glenn Thibeault said...

Glenn Thibeault said...
Aaah yes you have created a local mapping list and placed the list view web part for this on the page. This is the wrong web part. You need to add a "PlanetWilson Calendar Colour Coder" web part, see attached picture for details. Can you update the blog if this helps?

I was picking the first instance of "Calendar Colour Coder" not the second instance listed under web parts. If you pick the correct one it doesn't show on the final view. Thanks to Mark.

tlyczko said...

Please consider writing a blog entry about how your code/solution/etc. could be used to create tooltips for each calendar day's item's when the calendar is shown in day, week, or month view.

I know this could be done by calling the list web service, but walking the DOM and knowing 'which' day is being moused over to display the correct text in a tooltip is what most of us are not sufficiently skilled to do in JavaScript.

I really appreciate your hard work on this, the commercial products that do color coding typically cost $400.

OH -- it's easy to add a calendar color legend -- just create another CEWP above or somewhere on the calendar page, and write HTML code corresponding to the colors and their meanings. This takes some time and requires manual maintenance though.

Thank you, Tom

P.S. I agree that list views should not be color coded.

Mark Wilson said...

What would be displayed in this tooltip? Content from another field on the event?

tlyczko said...

"What would be displayed in this tooltip? Content from another field on the event?"

Event details from some or all the fields that are not shown within the actual calendar day, week, or month view. The Bamboo calendar webpart does this, for example, they must be using some method similar to what you do.

Something to consider for you or another blog reader who is very experienced with JavaScript or other forms of SharePoint coding.

Thank you, Tom

Mark Wilson said...

If I get time I might look into it, due to the way I have implemented this however there is only so much information that can be passed through for the Javascript to process.
The bamboo solutions calendar is a bespoke web part written from scratch where as I just re-use the in-built one and use trickery to colour it in!

tlyczko said...

Hi, it doesn't have to be you per se who does it, maybe someone else who reads the blog.

I know bamboo is bespoke, we tried it, it's nice, but yours is much more cost-efficient. :)

I just thought you may be able to make some comments to shed light on the topic.

Anyway, thanks for at least thinking about it for a few moments, and I do appreciate the time you took to redo this amazing little gem!!

Thank you, Tom

Anonymous said...

First of all, thank you for your hard work. I can't seem to find the field where I can make the colour coding web part point to the new mapping list. I think I saw it somewhere but can't locate it anymore.

Anonymous said...

I found it. It is in 'PlanetWilson Calendar Colour Coder' webpart and not the calendar.

Anonymous said...

I am trying to install the calendar, but while running the batch file I get an error during the activationfeature call:

D:\Software\SharePoint Tools\ColourCalendar>stsadm -o activatefeature -filena
me PlanetWilson.SharePoint.ColourCalendar\feature.xml -url http://localhost/ -
force

Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))


Please let me know if you have seen this error or if you have any recomendations.

Thank you,

Mark Wilson said...

I haven't seen that before, did the previous steps in deploying the solution work okay? I suggest you turn on diagnostic logging in central admin and try again then inspect the logs to see if you can spot what might be going wrong. Feel free to email me the logs if you like.

Mark Wilson said...

Also is your site available on http://localhost ? if it is on a host header or port you will need to update the install script.

Alata said...

Apologies for being completely dense, but I can't seem to get this to work. I have created a PlanetWilson Calendar Colour Coder web part under my calendar web part and pointed the Mapping List URL to where our Mapping List is stored in the Site Collection. The PlanetWilson Calendar Colour Coder errors with the note that it can't find the Mapping List.

The URL doesn't include the view part, as you instructed.

I have created a column called 'Event' and given the calendar entries a 'Business' or 'Important' value per the Mapping List.

Can you tell me what I have forgotten? - Thanks!

Mark Wilson said...

I am not sure what you mean when you say you have created a column called 'event'. Can you email me a screen shot of the list and the exact URL you are using for the mapping list?

blog@planetwilson.co.uk

Hector Insua said...

Excelent! i have posted your link in my blog www.sharepoint2007.co.cc in spanish.

Anonymous said...

I am testing on a Virtual WSS3 server.

I have a default setup and when I run the batch file I get errors:

Failed to find the XML file at location '12\Template\Features\PlanetWilson.SharePoint.ColourCalendar\feature.xml'

"PlanetWilson.SharePoint.ColourCalendar.wsp" does not exist in the solution store.

I have the zip extracted to a folder on the desktop.

Mark Wilson said...

You need to ensure you add and then deploy the solution. There should be a batch file included which will add the solution. It does require stsadm to be on your path though. Did the solution get added successfully? Email with any errors if you wish. blog@planetwilson.co.uk

Anonymous said...

Mark,

I got the batch file to run. My fault. Here is what I did for anyones future reference.

I added "cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN" to the begining ro run stsadm. So the batch runs from the bin dir.

And replaced http://localhost with http://mysite:Port

also I added the path to the PlanetWilson.SharePoint.ColourCalendar.wsp file in the stsadm -o addsolution -filename line.

It is now installed.

Just trying to figure out how to get a calendar set up. Maybe some detailed instructions, step by step?

Anonymous said...

Hi Mark

Is there any chance to use this calendar functionality displaying People and Groups field in a calendar?

My goal is to create Team Planning- I need to have People names in the calendar (instead of the events) and based on the colours, I will know what they're doing.
However, with People and groups filed type, the colouring doesn't work.

thank you in advance

Mark Wilson said...

Unfortunately I do not know of a way to do this, the solution relies on calculated fields and person fields are not allowed by SharePoint to be used in calculated fields.

Anonymous said...

Is there a way to have the calendar print the same way it looks in Sharepoint? The colors work great while in SP but as soon as I print the caledar out, it seems to use the default colors.

Thanks
RN

Anonymous said...

I feel a little in over my head, I'm a new Sharepoint user, but I got this calendar to work for me, except... if I do not choose an entry to be an all day event, it won't always show on the calendar. If there are no other events that day they might show, but then I have to expand the day to see them. Even if the day is empty they show as MORE entries. And if I expand MORE, they are invisible. The entries show on my All events List, but not on the calendar. What am I missing?

Mark Wilson said...

I am not too sure at the moment, I think it must be down to the stylesheets having some target media stuff i them. I'll see if I can find out.

Mark Wilson said...

If you email me some more details I will take a look for you.

blog@planetwilson.co.uk

Xene said...

It might be helpful to add a tip or two about creating new views and filters because that gave me some trouble. The Calendar Columns of Month, Week, and Day View Titles need to be set on Event Category Title to show the colors. But you have to filter using Event Name. Took me a few tries to get that to work.

It was also a bit difficult to figure out just what was meant by the color mapping direction needing to be added to the "PlanetWilson Calendar Colour Coder". For those of us less computer-literate, it requires the URL address of the colour mapping as it shows in the 'Modified Web Part' to be pasted in the "PlanetWilson Calendar Colour Coder" modified part under Advanced, Color mapping.

Those tips might help someone else vocabulary challenged like myself to have a bit easier time of figure it out. This is a great calendar Mark, thanks!

Anonymous said...

Great! Would it be feasible to make the colour coding work on an existing/standard Event Calendar?
Thanks, Jeroen

Mark Wilson said...

If you have some existing calendars then you would need to employ the method in my original colour calendar post, you should find it in the post history.

Andrew Backway said...

Great idea, is it possible to also encorporate colour coding when syncd with outlook?

Mark Wilson said...

Unfortunately not as it is done in a completely different way.

Jack said...

Mark, Just thank you. I've been trying a dozen different ways to do this. This solved my issue and saved me tons of time.

This should launch me far enough ahead so that if I need to add other functionality to it I can.

Anonymous said...

While creating a new event, if you click on the down arrow, next to 'New', it says 'Color Calendar Event'. How can I change this to 'New Event'?
Thank you for the great work!!

Mark Wilson said...

You might need to go into Site Content types in the root site and try and change the name there, if you can't do it there then you would need to download the source code, change it in the code, recompile and redeploy.

Anonymous said...

I have installed the Calendar color webpart onto my site but for some events it does not show up on the month view but it shows up on the day/ week view. Any idea why this is happening?

Yonz said...

Hi,

Great idea, I must say.

However, I'm having problems gitting it to work. I insalled it using the "Redeploy.bat" file (after changing "http://localhost" to my sites URL) It ran thru, no error messages at all (except ofcourse saying that the solution didn't exist while retracting and deleting the older version)

Then (even after restarting the web service in IIS admin) I do not see the two custom lists ("Colour Calendar" and "Colour Calender Mapping")

Did I miss something in the install instructions? Or are there some other "obvious" steps that a super experienced SharePoint admin would do blindly, but Amatures like I don't know about?

Any help would be much appricated.

TIA
Yonz

Mark Wilson said...

Not sure, I haven't come across that. is there any different about these events. is it all events or just some? Are these events not appearing or just not coloured?

Mark Wilson said...

Make sure you activate the feature at the site collection level.

Manoj Chhabria said...

Thanks a lot buddy for the hard work...
Is it possible to filter the calendar dynamically ?

Mark Wilson said...

I am not sure what you mean?

Yonz said...

Hi again ...

I got the Colour Cal working now ... thanks for the hint re. Activation.

Now I got a new issue. Everyone likes what they see, but would like to be able to view the Colour Calendar in Outlook like a "normal" sharepoint calendar. Is this possible? ( Yes, I know that we'll not be able to see the Colours, but thats fine ...)

Any feedback will be much appriciated,

Yonz

Mark Wilson said...

I am looking into this problem now.

Anonymous said...

Mark thanks for your work on this. We bought the Bamboo web part last summer but I like the idea of using the actual Calendar Web part and just customizing like you have done. frankly I just think it looks better =:-)
Have you ever looked into setting up a1-way sync from outlook 2003 to a MOSS 2007 calendar using "Mail to"? That's what I'm wrestling with at work right now. Your coloring solution is elegant, but unfortunately coloring is only half of my battle.
Respectfully,
Scott M, Norfolk VA

Anonymous said...

For Scott M, why stop at MOSS 2007??
Why not include WSS 3.0 too??
Thank you, Tom

Mark Wilson said...

--- UPDATE ---

A quick note to say a new version is in production which will address some of the issues raised including the loss of Outlook integration and meeting sites.

Anonymous said...

Thank you for your great calendar. But I have a question, I want to deploy this on my existing calendar (becuase of the data). I read your earlier posts but there you need to change events and colours in the js code.
Is there another way to put your latets post on my existing calendars?
Mayby copy the data to the new calendar?

Thank you for your support

Mark Wilson said...

The new version which I hope to release soon will do this, the new version will not have custom lists for the functionality but will allow you to turn it on or off for the standard in built calendar. This should also mean the Outlook functionality works.

northplatteriver said...

Have finally got it installed. Using it on a site located at http://server/test. Using just a standard work group template. Have opened the calandar.aspx page in spdesigner and added the webpart, but I am getting "Unable to find list "colour calendar mapping" in site "http://server/ error message. I have attempted to put in a mapping list url but then I get a different error. I tried to use the ones you had listed (./mappinglist2 and http://server/test/mappinglist2) but then the error message is Unable to find list "./mappinglist2" in site "http://http://server/test" Any help appreciated

Mark Wilson said...

Can you ensure that you have the latest v2.1 version? Also make sure you have access to the mapping list in the root site and that it exists.

Anonymous said...

Yes, I installed the most current version from the download site. I am not sure how to check and see if I have access to the mapping list, the account I am using is admin to the site so I assume I do. Not really sure how to locate the mappinglist. Is that something that was put in during the install?

Mark Wilson said...

The mapping list should have been created in the root site upon install. Please email me directly at blog@planetwilson.co.uk and I will see if I can help

Anonymous said...

Sorry I am being a pest, the installed version appears to be v2.2 is what it is telling me when your bat file runs. As I mentioned earlier, i can now see the Colour Calendar Mapping in the Custom Lists, but I do not see the Colour Calandar in the Custom Lists. I am assuming it is not installed properly. I have uninstalled and reinstalled a few times, any other suggestions?

Mark Wilson said...

There s a link at the top of this page to an updated post explaining about the newest version. It no longer requires a custom list, it is an option under the settings of a normal calendar.

Anonymous said...

Mark, Link does not appear to be working, clicking the link keeps me on the same page

Anonymous said...

Thanks a million! It works great. Really appreciate you putting up with my questions.

Mark Wilson said...

You need to click on the work 'here" in the phrase "This article has also been superceded by an updated V2 version which be found here"

Alternatively type this into your browser

http://planetwilson.blogspot.com/2008/02/version-2-of-colour-calendar-released.html

Brajendu Kumar Das said...

Thank you for your great calendar. But I have a question, I want to deploy this on my existing calendar . I read your earlier posts but there you need to change events and colours in the js code.

Any hints...?

Mark Wilson said...

Please read the link at the top and go to the newest version which works on normal existing calendars. This is an old version.

Blink said...

Hi Mark,

My conpany is using a hosted Sharepoint site at Sherweb in Canada.
They only accept new webparts with a .dwp extension. Is there a way to turn the .wsp into a .dwp file ?

Regards.

Nicolas Gyorke

Mark Wilson said...

A wsp file is a solution file and contains many constituent parts, not just a web part. There are custom lists as well. It uses the built in calendar but does add a web part to do the colouring. If they will not let you install solutions then you will have to use the manual method I desribe in the September 2007 post :-

http://planetwilson.blogspot.com/2007/09/sharepoint-2007-colour-color-calendar.html