Tutorial: add color coding to your SharePoint 2007 calendar in 15 minutes

May 2010

Environment: SharePoint 2007 – wss or MOSS (no SharePoint Designer or third party application required).
Audience: confirmed end user, power user.
Permission level: design or full control.
Estimated time: 15 minutes.

0- Before you start
1- Select your colors (5 minutes)
2- Create your calculated columns (3 minutes)
3- Set up your calendar view (2 minutes)
4- Render the colors (5 minutes)
5- If you want to undo your changes
6- A note for SharePoint 2010 users

0- Before you start

To follow this tutorial, you need a calendar created in SharePoint 2007 (wss or MOSS).

 In my example, taken from Mark Miller’s community calendar, items are organized in categories:
– Online Event
– Online Workshop
– Training
– Conference
– User Group
– SharePoint Saturday
– Other 

I have created a choice column, called “Category”, to store these choices. Note that for this tutorial seven is the maximum number of choices. If your choice column has more options, only the first seven will be color coded.

A choice column is the natural option to organize items in categories. You can also use any column type that contains text or numbers, like content type, text column, calculated column. Note that columns of type Lookup will not work for this tutorial. 

Usability tip: People can distinguish up to ten different colors that are assigned to different categories, but it may be safer to use no more than five different colors for category coding. (source: rightpoint))

If your choice list includes more than seven choices, this follow up article will show you how to proceed.

Ready? Let’s see if we can get our color coded calendar in less than 15 minutes…

1- Select your colors (5 minutes)

To choose your colors, simply fill out this online form. In my example:
– choice column: Category
– choices: paste here the choices from the choice column
– display: Title (the event title will be displayed on the calendar)
– keep the default value for the other options (except if you are on a non-English SharePoint farm)
– Use the color pickers to select your colors for each choice

Note: the semi-transparent background will not be rendered in older browsers (like IE 6). 

After selecting your options, scroll down to the bottom of the form. You’ll see two formulas (pale-green text areas). Leave this page open or save your two formulas, we’ll use them in the next step. 

Note: you can choose to group the two formulas into one by unchecking the “Separate Color Column” checkbox.

While we are on this page, let’s grab the script that we’ll use later for the rendering:
– click on the Download tab.
– right-click on the last file name TextToHTMLlite-v2.1.1.txt, and select “save target as…” to save it to your computer.
– upload the file to a SharePoint library in your site or site collection. The location doesn’t matter, as long as your users have read access to the file.

Note! the download section displays 4 files; pick the last one for this tutorial.

2- Create your calculated columns

On your calendar page, select:
List > List Settings

On the List Settings page, create two calculated columns (use the “Create column” option for this):
– First column, named “Color”: paste the first formula.
– Second column: named “Display”: paste the second formula.

3- Set up your calendar view

Staying on the settings page, under Views, click on your calendar view. In the settings page, choose to display the “Display” column. Save your changes.


Now, go back to your calendar view, and you should get an ugly result like this:

Don’t worry, we are going to fix this in step 4.

4- Render the colors

We can now use the script we grabbed in step 1:
– go to your calendar view, and switch the Web page to edit mode:
Site Actions > Edit Page
– Click on “Add a Web Part”, and add a Content Editor Web Part to the page
– drag and drop the calendar view above the Content Editor Web Part (the order is important)
– in the Content Editor Web Part, click on “open the tool pane”
– under content link, paste the URL of your TextToHTMLlite-v2.1.1.txt file (remember, you stored it in a document library in step 1). 

If you now exit the edit mode, you should see your calendar in color.

5- If you want to undo your changes 

A key advantage of this technique is that all our customizations were made through the SharePoint UI and can easily be undone. If later you want to revert to the initial view:
– remove the Content Editor Web Part from the page
– go to the view settings page and replace Display with Title as the displayed column.
– delete the two calculated columns.

6- A note for SharePoint 2010 users

In SharePoint 2010, the script from step 4 will not work because calendars are rendered asynchronously. Alternate options can be found in this post.

Updates [09/08/2010]:
– Links now point to the new location for the SharePoint User’s Toolkit
– Link to follow up article for more than seven choices
– Note for SP 2010 users

Update [12/06/2010]:
Brendan Newell published an article based on this tutorial, with a couple additional tips. For example, here is the style in SharePoint 2010 to remove the default background from the event:

<style type="text/css">
.ms-acal-selected, .ms-acal-item {

The article also mentions a resizing issue, which AFAIK is linked to the default calendar, not to color coding.
Check out Brendan’s article for more information!

519 thoughts on “Tutorial: add color coding to your SharePoint 2007 calendar in 15 minutes

  1. Really like this article – especially the way you have broken the time down. We know the importance of colours too – with our SharePoint themes to match your company colours – add a colour coded calendar and you are off!

    • My CEWP says, “Cannot import this Web Part. Microsoft. SharePoint, Version =…..any suggestions?

      • I also get this error. Was there any resolution to this? (I followed the steps exactly — they were great — up to this point where I thought it would work and it doesn’t. 😦

        • Yes in step 4…the CEWP at the bottom shows this message:

          Default Use for formatted text, tables, and images. true Right 2 Normal true true true true true true false Modeless
          Cannot import this Web Part. Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c Microsoft.SharePoint.WebPartPages.ContentEditorWebPart /* Text to HTML – version 2.1.1 Questions and comments: Christophe@PathToSharePoint.com */ function TextToHTML(NodeSet, HTMLregexp) { var CellContent = “”; var i=0; while (i < NodeSet.length){ try { CellContent = NodeSet[i].innerText || NodeSet[i].textContent; if (HTMLregexp.test(CellContent)) {NodeSet[i].innerHTML = CellContent;} } catch(err){} i=i+1; } } // Calendar views var regexpA = new RegExp("\\s*\\s*”); TextToHTML(document.getElementsByTagName(“a”),regexpA); // List views var regexpTD = new RegExp(“^\\s*\\s*$”); TextToHTML(document.getElementsByTagName(“TD”),regexpTD); // Grouped list views ExpGroupRenderData = (function (old) { return function (htmlToRender, groupName, isLoaded) { var result = old(htmlToRender, groupName, isLoaded); var regexpTD = new RegExp(“^\\s*\\s*$”); TextToHTML(document.getElementsByTagName(“TD”),regexpTD); }; })(ExpGroupRenderData); // Preview pane views if (typeof(showpreview1)==”function”) { showpreview1 = (function (old) { return function (o) { var result = old(o); var regexpTD = new RegExp(“^\\s*\\s*$”); TextToHTML(document.getElementsByTagName(“TD”),regexpTD); }; })(showpreview1); } ]]>

          And the calendar items still look all jumbled as you show in step 3.

    • Hello …
      I hope someone is still out here :). I followed these instructions exactly ( many manay times) and each time after step 4 – instead of the color coding I get =””&[Title]&” in each of the tile sections and no color.

      Please let me know what I am doing wrong. Anyone 🙂

      Thank you


  2. Pingback: Linkliste zu SharePoint 2010 und MOSS 2007 – 2010/04/07 « Sharepoint Infoblog

    • That’s a good point, and classes would definitely be a more elegant solution for one single calendar.

      The reason why I didn’t do it is that the code (TextToHTML) has larger applications that just color coding. It can be stored in a central place and called by multiple pages to render indicators, inline charts, icons, tooltips, Flash, videos, etc. Also, it can be used on multiple calendars, each having its own palette. So I kept the code generic, and included in the formula what was specific to this calendar.

  3. Hi,
    very easy, i did everything right but it is not working , i am using this on machine which does not have internet connectivity…
    still showing the code no colour, what could be reason….

  4. When I try to create the “Color” column I get the following response after clicking “OK”: One or more column references are not allowed, because the columns are defined as a data type that is not supported in formulas.

    I create the column as a “Calculated” column and add the formula that is generated, but always get that error. Is the version of SharePoint I am working on to old?

    • What is the type of the column that stores your choices? It has to be a choice column, or text, or similar. Lookups and People columns won’t work.

        • My Resource column was a Choice, but it used Check-boxes so that more than one resource could be selected, the script will only work with a drop-down menu of choices. I created another column of drop-down choices to be the reference column and problem solved.

        • Thanks for the update, and glad to hear it is working.

          The method could work with multiple choices, but then you’d have to use a “contain” operator in the formula, instead of “equal”.

        • Hi – please help! Like GRS, When I try to create the “Color” column I get the following response after clicking “OK”: One or more column references are not allowed, because the columns are defined as a data type that is not supported in formulas.

          You had suggested “The method could work with multiple choices, but then you’d have to use a “contain” operator in the formula, instead of “equal”. but I don’t know how to write the statement correctly – my column name is Absence Type, and it has two drop down choices “NYSE/NYMEX Holiday” or “Personal Vacation” which I would just like to make 2 colors and I could care less what they are!

          I would appreciate help if you can! Thanks so much!!

        • Two issues here.

          First, it seems that the column you are using is not accepted in formulas. I don’t know why. Accepted column types are text, number, choice, date.

          Then you’ll need to write the statement yourself. See the SharePoint help to learn about formulas in calculated columns.

        • I also would like to use this on a multiple-choice (check-boxes) column. Your tantalizing comment “… you’d have to use a “contain” operator in the formula, instead of “equal” gives hope, but I have not been able to find any “equal” or “contain” operators in any of the SP formula (or indeed Excel formula) resources. Christophe, could you be a bit more specific? “=IF(ISNUMBER…” and “=IF(FIND…” seem to be dead ends.

  5. cant seem to do the following on WSS 3.0

    step 4: -drag and drop the calendar view above the Content Editor Web Part

    Everything else is as described

    • Joe, the drag and drop behavior is attached to the Web Part title. When you move a Web Part around, SharePoint displays a colored line when you reach an area where you can drop the Web Part.

  6. Everything works to a T when I am in Calendar view, however, when I display the calendar on the Home screen the color coding does not work. Descriptions for the events are displayed correctly (i.e. not in HTML format) but the color coding does not work. I added the CEWP below the calendar on the Home screen and tried using the full script rather than the lite version but still no luck.

    Is it possible to color code on the home screen using this method?

    I am very new to SharePoint so I apologize if I am not using the proper terminology to describe my problem.

  7. Removing the Calendar from the Home page and re-adding it fixed my problem. Should of tried that first!

    Thanks so much for this tutorial.

  8. I can’t seem to get this to render properly. The calculated columns both produce the right values and they’ve been added to the view I’m displaying and the default view for the list. I’ve created a separate web part page, added the calendar web part and the CQWP. I first added the script to a library and reference the scripted from the CQWP. When that didn’t work, I tried removing the link and simply copying the JS into the source view of the CQWP. Neither approach produced a rendered version of the HTML produced from the Display column.

    At one point (in edit mode), I saw some of the event color coded, but as soon as I exited edit mode, everything went back to the “HTML” view.

    Any assistance you could provide would be greatly appreciated.

        • I didn’t miss any steps. However, I did miss the part where you state I needed to place the CEWP before the calendar view web part. Reorienting the web part after the view web part immediately fixed the problem. Thanks VERY much for your help!

      • How would you go about doing that? Overwrite the parent node? I’m not a coder at all so I’m not quite sure how that is done.

        BTW, thanks for this tutorial. It was very helpful for someone managing a SharePoint portal for the first time.

  9. How can you make a legend for the different colors and also make it so users can use that legend to filter on the events?

    • AFAIK there is no way out of the box to filter a calendar Web Part. The simplest solution is to create multiple views – one per filter.
      Another approach would be to write a custom script that will show or hide events depending on the color.

      For the legend, two options:
      – use a Content Editor Web Part to enter the legend as HTML. An example here:
      – create a custom list and apply the same customization as for the calendar, with one fake event for each category.

  10. Hi!

    Nice tutorial, but I can not seem to get it to work. The formula contains a syntax error or is not supported, WSS 3.0, says. Maybe I’ve forgot some setting for the list? Wich setting should I use for when creating the “color” column? Apart from pasting the code? Just standard?

    • See if you didn’t make a basic mistake (e.g. “color” instead of “Color”). Also, check the language if you are not using an English version of SharePoint (cf. drop-down list in the form).

      • Thanks for your quick answer! I did not misspell but I have a swedish locale setting, otherwise its the english version. My error might come of me using a template where I have the setting to allow content type change. So, I suspect that it could be this or the locale that halted my progress. But, now I’m on track again. Thanks a lot and keep up the good work!

        • Hi,
          I also have the same issue with the “syntax error” message. I’m using the swedish version of WSS. How did you get this to work? I changed the IF’s to OM (swedish). Is there anything else in the syntax that needs to be done?
          Tacksam för svar …

  11. This helped a great deal. Though I am having an issue where I dont want the time to be displayed and I have a Content Web Part that has the following code in it. When I added the part for the Color Code it broke the code to not display the time. Is there a way around this?

    • Sorry forgot the Code for not displaying the time.

      td.ms-cal-monthitem A NOBR {display:none;}

      • Duston: my current scipt modifies the page in a way that your custom style doesn’t apply anymore.
        Two workarounds:
        – modify my script so that it doesn’t affect the times
        – instead of a stylesheet, remove the times via a script

      • Hi,

        I am having same issue. Did you get any solution to remove time from calendar view?

        Thanks in advance!

  12. hi christophe,

    first of all let me thank you for this great tutorial… i’ve been looking for a way to add colors to my company’s calendar for a while.
    the only problem i get is when opening an appointment in the calendar. when i open an appointment instead of seeing the “Display” color as the headline in colors i see the code itself – meaning there’s no translation from text to HTML.
    in the calendar view i see it ok with colors and everything, its only when i open an appointment that i see the code =/

    I’d appreciate the help!

    • Right, this is the expected behavior, as you have only put the text to HTML script in the calendar view.
      Two ways to fix this:
      – set the calculated column to hidden, then you won’t see it in the single item view.
      – add the text to HTML script to the dispform.aspx page, then it will render the same way as in the calendar view.

      • just as i thought… the only problem is i dont know how to hide a column 🙂 i’m kinda new in this

        • You’ll have to go to the advanced settings of the list and turn on the “Allow management of content types.” Then in the list settings, you’ll see an extra settings for “content types”.

          Click the “Event” content type link. This will show you the columns associated with that content type. Find the ones that you would like to hide (e.g. Color & Display), click on them, and set them to “Hidden”.

  13. Christophe,
    How would you modify your script to remove the times? I am new at the development part of Sharepoint. Having a hard time trying to figure how to setup the script.

    • Duston:

      The time appears to be a part of the anchor link, which is the parent of the Span Christophe’s script inserts for color coding. I believe the approach would be to loop through all of the TD’s with the “workitem” class applied, find the anchor link that represents the item in the calendar and then remove the text next to the color coded span that the calculated column is inserting.

      I hope this helps.

        • Duston:

          I don’t have the time to complete a working version that does precisely what you need, but here’s a script that will loop through all of the TD’s and manipulate the innerHTML property of a DIV tag. This, in principal, is the same pattern you need to use, except that you’ll need to locate the SPANs inserted by the calculated columns, grab the parent of that node and change the innerText property.

          Insert the event icon script
          Written by Consejo, Inc.
          Questions: info@consejoinc.com

          var iterator = document.getElementsByTagName(“td”);
          var i = 0;
          var thisNode;
          while (i 0)
          thisNode = iterator[i];
          var moreNodes = thisNode.getElementsByTagName(“div”)
          if(moreNodes != null && moreNodes.length > 0)
          for( var x = 0; x < thisNode.attributes.length; x++ )
          if( thisNode.attributes[x].nodeName.toLowerCase() == 'class' && (thisNode.attributes[x].nodeValue.toLowerCase() =='ms-cal-topday' || thisNode.attributes[x].nodeValue.toLowerCase() =='ms-cal-topday-today'))
          var onClickEvent = thisNode.getAttributeNode('onclick').nodeValue;
          var origEventDate = onClickEvent.substring(16,37);
          var cleanUp = new RegExp(/^([1-9]|1[012])+\\u002f+([1-9]|[12][0-9]|3[01])+\\u002f+\d\d\d\d/);
          var cleanEventDate = cleanUp.exec(origEventDate)[0];
          cleanEventDate = cleanEventDate.replace(/\\u002f/g,"-");

          moreNodes[0].innerHTML += "Event Info“;

          catch (e)
          alert( ‘Error: ‘ + e );

  14. Christophe,

    When I try to create the color and display calculated columns I recieve this error every time:
    The formula contains a syntax error or is not supported. at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)
    at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)

    Am I missing something?

    Thanks for a great site,
    the KimcheeGI

  15. I’m successfully using this color coding approach. Is there anyway to display the calendar entry title on the *same* line as the start time?

    In all of my views (Month/Week/View), the entry displays on a new row below the start time. I’m using my calendar mostly to display availability times so my start & end times are the same. The Week/Day views cut off the text. I have to set each entry to at least 1 hour in duration for the entire title to display. This will be problematic when I try to display multiple events starting at the same time. All of my event titles are short text strings. It seems the “width:100%” attribute in the SPAN tag is controlling this. Any way around this? Ideally I’d like to see 1 row with start time & short description for all calendar entries in all views.

    • Well, have you tried removing “width:100%;” to see what happens?

      There’s actually another style that controls the layout: “display: inline-block;”. You’ll find those in several locations in the formula, remove them and let us know if it worked!

      • That removed the white background that surrounded both the start time & event description (which I also wanted to remove – thanks!), but the event description still appears on the 2nd row like your image at the beginning of this page. Any other ideas? Here’s my display field code (I changed the chevrons to square brackets so it won’t render as HTML):

        =”[span style=’position:relative;width:100%;height:100%’][span style=’width:100%;text-align:center;cursor:pointer;width:100%;height:100%;border:1px solid “&EntryForegroundColor&”;color:”&EntryForegroundColor&”;background-color:”&EntryBackgroundColor&”;border:1px solid’]”&Title&”[/span][/span]”

        • I played again with the “width:100%” attribute and removing it results in start time & description rendering on same line, but the colored background only encompasses the text string – I’d rather it fill all remaining width. If that’s not possible, I could input all events as all day events with the start time as the first X characters – if I could figure out to remove the extra white space/pading/box that SharePoint seems to add automatically to all day events.

  16. Thanks Shawn for the help. But I am still not able to get the times removed. I believe that it’s how the Calendar data is displayed because even if I hide the Start time on the Calendar list it’s still shows on the Calendar view.

  17. I’ve used the colour-coding calculated column and the TextToHTML script and it works fine to set a single column’s BG colour. Is there a means of doing this for an entire row? I’m really just trying to colour code (by priority) entire rows of the issue tracker akin to what you can get from gForge’s issue tracker, rather than just an individual column value.

    I tried having one column (e.g. Title in an Issue Tracker list) start a <SPAN style=…> tag and then close the SPAN tag at the last column in the row (adding the closing element after the data of that column).

    This seems to ‘break’ the script (why I don’t know!) such that what was previously happily being converted from text into HTML tags now ends up being text again.

    Thanks in sdvance,

    • I have published a solution for this on this blog, but some readers reported issues so I need to publish an update (it will be included in the user’s toolkit).
      Splitting a tag across multiple fields will break the script, as you experienced.

  18. how to do it for custom list. it gives error “The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column. ”

    i have unchecked the separte color column and it created one formula instead of two separate one.

        • So you created a choice column on your custom list and used that column to create the formula, right?
          As you created a single formula, didn’t you get in my formula form a red warning saying:
          “Alert! The formula has exceeded the 1024 length allowed in calculated columns…”

  19. When I try to create the “Color” column I get the following response after clicking “OK”: One or more column references are not allowed, because the columns are defined as a data type that is not supported in formulas.

    I create the column as a “Calculated” column and add the formula that is generated.

  20. Thank you so much for this posting! What an awesome tutorial! You saved us from purchasing expensive web part out there! I followed your instructions and the color codes work like a charm! Rather than uploading the texttohtml text file I copied the content and pasted it in the Source Editor of the CEWP.

  21. hi.. great work.. it worked for me on MOSS 2007
    but i was trying it on SharePoint 2010 but not yet worked .. i did exactly what i did in MOSS 2007..
    but the difference is the in 2007 i added CEWP and wrote the texttohtml list in source editor, in 2010 the content editor can only point to a file but there’s no source editor button in CEWP as it was in 2007, the source editor in 2010 is in the ribbon and that button on ribbon can’t find it on calendar edit page..

    may be it’s not done to work on SharePoint 2010

    the question can it work on SharePoint 2010? as i need it on 2010

    • It only works in SP 2007, and this is why I specified it up-front in the title. I’ll publish soon some other texttohtml sample scripts that should work in SP 2010.

      • ofcourse i gave it this a try on 2010 which didn’t work but works fine on 2007 … as u said…

        i really need this fast… can you explain the meaning written in texttohtml as i don’t understand it or how can i make one if i want to? because is it regex syntax, i think??

        thanks in advance.

        • See previous posts on my blog for more information on the script. You’re correct, this is regex, so check your usual regex reference to understand the expressions. The script looks for HTML strings (innerText) and replaces them with HTML (innerHTML).

          I published today a sample script for SP 2010. Note that the script is copyrighted, please contact me (Christophe@PathToSharePoint.com) before using it in a production environment.

          Also, note that I am available if you need personal assistance. Feel free to register for a one hour session on the home page of http://www.pathtosharepoint.com.

  22. Thanks! I got this working great for a custom list. But now I’d like to change some of the formatting of the list. Is there a way to get this to work if I change the list to XSLT view in SharePoint Designer?

    • Eric, there’s a post or two about this on my blog, search for DVWP and calculated column. You can also search for CQWP for another XSLT option.

  23. Christophe,
    Thanks for the great posting. I have a calendar up and running. There is one thing bugging me. I cannot get rid of the time being displayed on the calendar view. When I created my date column, I set it to date only. Regardless, it still displays the 12:00am on the calendar. Is there some code I can input either in the calculated column or web part that will hide the time?


  24. Hi,

    Nice Post. It really worked in WSS 3.0(2007). But i want to use this in 2010. Is it possible? I followed same process but its not working in 2010.


  25. WOW…it really worked for me. Thanks a lot for great post.
    How i can contact you through email or through any other medium?


  26. Hi,

    Now i am facing one issue. There is rendering issue. All the entries on color calendar take more time to get displayed.


  27. dear Ankit, does’nt take time, no one realize it.. but only will be noticed if u have slow internet connection.. i’m talking about online sharepoint.. or even less RAM, so takes time to load.

  28. Dear Christophe; i’m trying to do something with calendar, can you help me with this?

    when the calendar have more than 3 or 4 items, let’s 10 items on one day, it gives link [more] to see all items on that day, i want all items in calendar to open auto without i click on [more] this is for specific date.. but i want all to opened..

    in sharepoint 2010 calendar, there is two buttons on the ribbon of calendar [expand all] and [collapse all]

    i have to click on expand all to see all items..

    my question is:

    Can it be automically the expanded? as if this button is clicked?

  29. I’m running into what appears to be a bug with either Sharepoint or IE8, and I’m wondering if anyone else has experienced the same issue (and hopefully found a fix for it).

    When you add a calculated column to a calendar, each item on the calendar is redrawn every time you mouseover the labels on the top or left of the calendar (eg Monday, Tuesday, etc). This only happens when the calendar is displaying in “Week” mode, and it only happens in IE8. It might seem like a small issue, but it leads to a lot of blinking items on the screen as you move your mouse around.

    Since this tutorial makes use of calculated columns, it seems like everyone who has added this to their Sharepoint site should be running into the issue. Hopefully someone has found a workaround…

      • Unfortunately, no, and the problem still seems to be present with the IE9 Beta as well. The team I was making it for decided that they would rather deal with annoying flickering than buy a third-party solution.

        I’ve found that you can work around the blinking by forcing the browser out of Quirks Mode (and into IE7 standards mode, I think). You might be able to do this by adding a doctype and using “X-UA-Compatible” in a meta tag, but I haven’t actually tried this, so I make no promises. 🙂

  30. I would like to thank you for your posts on using calculated column to accomplish various tricks with color coding and such in Sharepoint. I only have access through my browser to the site I have been modifying and this blog has been very helpful. I had a notional idea that calculated columns could be used to generate html, but when the html displayed as text I was pretty stumped! I am pretty hopeless with javascript, myself. Your text to HTML script works great.

    Unfortunately the version of Sharepoint I am stuck using is 2003. Everything works like magic on the listviews, but it seems there are very few display options for the calendar view. Do you know of any way to change what column the calendar pulls from when populating the calendar with events? In 2007 it looks like it asks you what column to display for these different titles and sub headings, but no such luck in 2003.
    I think it is just grabbing the title column and making it a link to those pages that display all the information in all the column for that entry on the list, which includes my both calculated column and the column use to generate the text, making it give the same information twice (also I have to add the texttohtml part to EVERY one of these pages). If I could make it display with the entries in my calculated column so that they were both color coded and links to what I want them to be links to (in this case they are links to subfolders in a document library, one for each line-item; I generate the links pulling from what is entered in one column and then creating the subfolders myself with the same name to match) then all my problems would be solved!

    I guess my question is: do you know anything about 2003 and is there is any way to manipulate the calendar view besides the very few options it seem to be offering me? Alternatively: do you know of any good sources for information like what you have here, but for 2003?

    Thank you for your time.

    • What do I know about SharePoint 2003, I only used it for 4 years…

      I am afraid you won’t find much information about SP 2003, and my blog is one of the few to still mention it occasionally.

      There’s a way to manipulate the calendar through FrontPage, but I don’t have a reference to point you to. And I don’t have FrontPage anymore 😦

      • You would think I would be more adept at locating this kind of stuff for myself, but my google-fu is seriously lacking when it comes to finding relevent tutorials online.

        This does look to be what I need. I have a few problems to work through still, but this is definately a step in the right direction. Thank you very much.

  31. I used this on a task list to highlight status, first time trying the color coding – and I timed it, 13 minutes! Thanks Christophe!

  32. Lydia and Kerri, you can’t imagine how important your comments are to me.

    I put a lot of effort in developing solutions, but providing them in a way that is easy to implement is yet another challenge.

    I hope your feedback will convince other readers to try this out. Thanks!

  33. Hi,

    I have tried to use this, but for some reason I just keep getting every event in one colour. I have followed the steps a number of times now without much luck.

    Can anyone help?

    • So at least it means that color coding is working, right? Then you’ll need to check your formula (spelling mistake, upper/lower case, wrong choice column, etc.). Also, see which color is selected and try to understand what’s special with it.

  34. Yes it works fine…except that it is all violet! I don’t think it is a spelling mistake as I have gone through checking your code which I copied and pasted. Do you mean a spelling mistake elsewhere?

    I have just tried adding an event too and I can choose the type of event but it is not coded at all. I am not the worlds greatest user of this programme, but I have successfully managed to impliment a number of extra features and just don’t understand why this isn’t working!!

    I am using Windwos SharePoint 3.0 just in case that makes a difference to anything.

  35. Ok, my mistake and I have made it all work correctly now! Thanks for your help!

    How do we replicate this information from this main events calendar to a viewable calendar on the home site where meetings are replicated but colours are not? Is there a way to link them? I have added the content editor web part as a start…

    Thanks again

    • The same procedure should work on any page: change the settings of your calendar view to display the calculated column, and add the script below the calendar.

  36. How do you get around the Sorting, Grouping, and Filtering not working because they are calculated fields?

    • I just sorted, grouped, and filtered by the column I was pulling the text from. IE: the “title” column instead of the “display” column.

    • I would agree with Elizabeth, do this on the original column, not the calculated one.
      I have written scripts to work around these issues, but there is no simple answer. Also, you might reach some SharePoint limitations (e.g. 256 characters in filters).

  37. Is there any way to carry these colors over on the sharepoint calendar you see in Outlook after doing this color coding on the sharepoint site?

      • I’m also pretty sure the colors can’t be synchronized with Outlook. Apparently Outlook can’t receive custom categories of information from Sharepoint, and the first step in creating a color calender in Sharepoint (actually the ‘Before You Start’ step) requires creating a custom column for ‘Category.’

        If you aren’t using the Location column, you might be able to put ‘Category’ information there and sync that with Outlook’s ‘Location.’ You might then be able to create filters in Outlook that would automatically assign a color category in Outlook based on an item’s ‘Location.’ This is all theoretical – I haven’t actually tried it – but it’s the best potential solution that I’ve come up with so far. If you try it and it works, or if you come up with a better solution, please report back here, because I’m interested in doing the same. Good luck!

  38. Christopher –
    First, I must mention that your blog is incredibly helpful and I can’t thank you enough for your work. I am a teacher with 45 minutes per day allocated to all technology needs that the rest of the staff has, including Sharepoint. I have no budget to speak of to implement sharepoint solutions, so your postings have been essential in allowing us to create custom modifications. (calendars shared on multiple sites, 5day/expanded view calendars, photo rotators, etc.)

    In this color coding calendar, I have been able to apply the CEWP successfully and code assignments as homework, tests, etc. Very helpful.

    However, whenever I wish to edit the page, I first have to close the CEWP or else I get an interminable freeze. Easy enough, I close, edit, and reopen/move the web part. But it does seem to indicate that I’ve done something wrong in the implementation.

  39. Hi Christophe

    Your blog is just amazing. We are looking for this type of customization for our calendars on our site for so long. And I was trying many messy and bulky codes to accomplish it however no luck. This article convert my 15 days task in to 15 mins which is just fantastics. I cant thank you enough for the help I get by this blog.

    Can you please let me know if you have any solution to restrict conflicts of the saved events. Say for example, I booked a meeting on 06 Aug 2010 from 8 am to 9 am for SharePoint Lecture, and again someone goes and book another meeting for the same date i.e. 06 Aug 2010 at 08:30 am to 09:30 am for .Net Lecture (this calendar is for same meeting room). Then while adding second event I want to restrict user saying that this time on this date is already booked, please select some another time.

    My main purpose is to just avoid these types of overlaps in calendars. I would really appreciate and gratefull to you if you can help me out to get this done.

    Thank You


  40. Hey Christophe,

    Thanks for the great tutorial. I have one slight problem. We need the title of the calendar to display on the calendar. As I have it set now it pulls the choice column. Is there a way to display the title of the entry and have it color coded?

    • Julie, in the formula generator there’s a field where you tell which column to display. Just enter “Title” (which is actually the default) and it’ll work.

  41. This works like a charm. Follow the directions and you won’t have any problems. Thanks for this, it really makes the calendar more useful.


  42. Christophe,
    Thank you for this tutorial, I got everything to work great. I do have a question, before I added this to my calendar I had a previous calculated column that would contantenate two fields together. For example, One to show who was out on vacation and the reason displayed. Is there a way to get it to show this again?

  43. Thanks for the tutorial. I am able to create a color coded vacation calendar for my office after reading your tutorial. Everything looks good. I also want to display the “Start Time” and “End Time” of the Leave/Vacation on my calendar or Number of hours. How do I do that?

    Thanks in advance.

    • The formula generator only takes a single column, for example [Title]. In your case, you’ll need to replace [Title] with your own custom display, for example:
      [Title]&[Start Time]&[End Time]

  44. This blog is awesome. I can now track events types waaaay easier than before. Now if only I could merge multiple items in the gantt view (eg events) on to a single line….

    Thanks again.

  45. Hi Christophe,

    Thanks for this blog! Your directions are very clear and easy to follow, which means a lot!

    I’m using this for my second color-coded calendar. I have one question – I have created more views to filter out portions of the calendar into smaller chunks. The views are called “Training”, “Configuration”, etc. What part of the html do I need to modify to make the color coding appear on the other views?

    Thanks in advance.

    • If you created your views from the color coded one, they should also be color coded (make sure you display the calculated column).
      If you created them from scratch, hen you’ll need to add the Text o HTML script to each page.

      • AH! Yes, thanks for pointing me in the right direction. I updated the calendar columns and everything is working like a charm. 🙂 Many many thanks!

  46. I got it working in 15 minutes or less. Thanx for the useful information. After I got it working I changed it in an attempt to color code “Past Due” calendar items. I changed the color calculation to use the DATEDIF function. I have since found that the TODAY function doesn’t work for formulas. What is the best way around this?

    Thanks again, I Appreciate your time and efforts.

  47. I’m trying to use the color coded calendar I’ve created in a Web Part to my front page on our Sharepoint site. Unfortunately, the colors are not rendering — what I see is the display calculation. Is there a way to fix this?



  48. Question

    If the calendar view is diplayed in a list veiw (All Events) the display column shows the code and NOT the colors .

    Is there any way it can be made to display color code in other calendar views ?
    Also what needs to be done to use this for Lists ? Are any code changes needed ?

  49. If you see the code instead of the colors, it means that the Text to HTML script is not installed correctly on the page (see step 4 in the post).

    • Christophe – the colors show correctly on the calendar when I navigate to it via the list itself — they just do not show correctly when I try to display the calendar as a webpart on another page.


  50. I get the following error when creating the Display column

    The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.

    I’ve checked names and I don’t see a problem

    • Well, there must be something wrong. Note that the error message you get is from SharePoint, and is not directly related to the method. Also, note that this tutorial only applies to English sites, you’ll need to localize the formula if you’re on a non-English SharePoint.

  51. Christophe,
    Our team lead kept griping about not having colors on the calendar and our sharepoint support team didn’t “have the time” to help us out, so did a quick search and found your blog. Great tutorial for someone with close to 0 experience with Sharepoint. It took me a little longer than 15 minutes to get it completely working…. but hey 🙂

    I’ve got one question though, It is helpful to print out the calendar to bring with us to meeting. When we do that the text boxes are no longer filled in with color. They only show an outline in color. Is there an easy fix for that or should it do that already, but I have something configured incorrectly?

    Thanks again.

    • Hi Michael, glad to help!
      Search my blog for “printable”, you’ll find some explanations and workarounds.
      With the example presented in the post, you should at least get the border and text colors printed (this is actually one reason why I chose this style).

      • Christophe, thanks much. After searching your blog, I found a solution that worked. Ended up just setting the Print Background setting in the page setup for IE and Netscape.

  52. Hi Christophe,

    I love this blog–and I love my color coded calendar! It was really easy to set up. And I love that in dataview I can easily edit the type of event I have quickly. However, I’m having a problem with editing my page. Ever since I added the color coding, when I try to edit page, my entire page freezes. Thus I have to close webpart, then edit page, then reopen web part.

    Any ideas?

  53. Hi Christophe –

    This is a fantastic and very informative tutorial. Thanks particularly for the code generators. It all works very well for me. I’m using this to schedule conference rooms, and coincidentally have 7 rooms to work with.

    One question, however: I’d like the entire blocked time to render in each color, rather than just the line for the title. Using hints from this blog: http://www.endusersharepoint.com/2009/04/17/sharepoint-color-coded-calendar-the-payroll-schedule/ I changed the tags to tags, and it renders perfectly in day and month views, but not in the week view.

    For some reason, the script strips out all the rendered code code in the week view.

    Is there anything I can do about that?

    • Confirmed here as well. Using DIV instead of SPAN, and all views work PERFECTLY except a non-all day event in week view. All day events at the top work fine, but an hourly scheduled event does not render the HTML. Using IE 8 and WSS 3.0.

      Any thoughts on this are appreciated.

  54. Dear Christophe,

    I am an issue with retrieving the Text to HTML code.

    On the “Color-Coding Calendar List” page, where you type in the colors, the only tabs are “Select your Options” and “Instructions.” There is so “Download” and “Expand All” tabs as shown in the screenshot. Is there any other way to get the Text to HTML code?


  55. Starting this week, we have not been able to see the color coding that was working fine previously. The error message relevant to the CEWP that renders the colors is that “cannot connect to the configuration database”….. (the path I’m using is ttp://www.pathtosharepoint.com/Downloads/TextToHTMLlite-v2.1.1.txt)

    Can you help decipher this one? thanks,


  56. First, sorry about the situation. My SP 2007 hosting provider let me down, and I switched the tutorial as quickly as I could to my SP 2010 site hosted by fpweb.net.
    Pat, you are not supposed to link to my file. See the instructions and download a copy to your own site collection, it will be both more reliable and more performant.
    Dean, I have now included the “Downloads” tab in the new location.

  57. I have implemented this successfully and it looks good in Month View. However, in Day View, the color blocks get cut off because the daily time intervals are too short (vertically) to display the event time with the title below it. MUCH worse than this, in the Week view, the colored event blocks are also cut off and they flicker on and off until they just disappear. I know that sounds weird, but that is what is happening and I followed the tutorial to the letter and have a fairly standard setup running on IE8.

    Anyone else getting this? I probably cannot pitch a calendar that only looks good in one of the 3 built-in views.


    • Eric, what you are describing (blocks cut off) is a known issue with the default SharePoint calendar views. This tutorial simply adds color coding, it doesn’t fix existing SharePoint issues.
      As for the flickering, I haven’t experienced it myself. Let’s see if other people have the same issue. Here too, the color coding step should not modify the behavior.

  58. I am having trouble when it comes to step 2. I am able to create the “Color” column and use the formula, but when I go to create the “Display” column and click ok it comes up as an error and says that the referred column does not exist. (Error Message: The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.) I have no clue why it will not create the displayed column, but all I did was copy and paste the exact formula from the web site. I have closed the Sharepoint and reopened it to make sure it accepted the “Color” column but it still doesn’t work. Please help!!!!!

    This is the formula I am using for the “Display” column:

    =” “&[Title]&””&[Title]&””

    • Anna, what is the name you put in the “choice column” field? If you just use the formula as is, it assumes that your list contains a choice column called “Status”. Is it the case?

      • I am trying to use the color coding calendar to represent the different companies within the company I work for. There are 6 did company names and I currently have a column created for “Company” which is a choice column. So then I went to create the color coding and I named the choice column Company and input the company names and selected the colors. Then I went to take the formulas at the bottom of the page and I then created a new column named “Color” and it worked. Then I went to create the second column “Display” and copy the formula into the calculated field and I click ok and then the error message comes up. I have no clue why it tells me the referred filed doesn’t exist because the color column worked succuessfully. I am not sure what to do, or what I am doing wrong.

  59. I came up with a very kludgey workaround for the Today date issue. I created a Sharepoint time job that goes out to the list and updates a field called TODAY. This job runs a little after midnight and then several times throughout the day. I used the formula from the color coding utility with modifications. Then everything else is basically the same.

    Thanks for the help and the utility. I now have color coded past due calendar entries!

  60. Great tutorial! Colored calendar looks amazing. No need to buy third party web part. Thank you very much for your marvelous tutorial.

  61. Hi Christophe
    Thank you for this wonderful blog, i am quiet new to SharePoint but your tutorial took just under 15 minutes to work like a charm.
    Two questions; First, the color codes only work in daily and weekly view in calender, can this be fixed to also include in month view (or like Eric, this is a SPoint dev error). Next, every time a new entry which spans over multiple days is inserted, the color disappears. I have also tried to include start time and end time as part of the code as mention above, but no luck. Can you Please advice. Thanks

    • Arj, I don’t know what to say, none of this is supposed to happen. Do you simply click on the icons to switch between day/week/month views? Do you happen to have other custom code on the page?

  62. Christophe, I’m still trying to see how I can get rid of extra space and border for full-day or multiple day events. From April 27, 2010 at 1:39 pm post you answered another individual’s question with:

    You’ll need to modify the Text to HTML script. Instead of just overwriting the text, overwrite the parent node.”

    But I’m really new at this SharePoint, and would like to know how you can overwrite the parent node. Thank you for your help.

    • Oi Lee: this requires to adapt the script, and it’ll depend on your specific needs. I have sent you an e-mail.
      I am sorry that I missed your earlier messages.

  63. Absolutely great blog. I’ve done a lot of similar stuff, but nothing with Calendars, so this post saved me a lot of time. However, I couldn’t get mine to work just like your example. Straight up team site, with a fresh calendar. Followed your steps, and for some reason the code generated formula for the calc column didn’t have a “height: 100%;” in each span so there was a large box and just the event name was colored correctly on week/day views for events that spanned a couple hours. I made that change. However, my calendar wants to put a div with the time and then nest the calculated display column inside, so I get like a box with the theme color and the time, and then your color coded event inside. Looking at your example calendar firebug, it looks like the time and event are concatenated together…still working on this but hope to have mine looking like yours soon 🙂

    • Thanks for your comment Hans. Would you mind sending me more details, including for example screenshots (Christophe@PathToSharePoint.com)? It seems like I could use this to improve the formula.
      The current live example is slightly different from the tutorial. Feel free to look at the source code of the page for details.

  64. Christophe,
    As many have stated above, thank you for an informative blog. I’ve learned much from your comments and tutorials. In implementing the color calendar I’ve run into an interesting fault. The the color title is displayed twice unless the event is an all day event (checkbox selected) then it is displayed correctly. Any thoughts?

    • Phil, could you send me a screenshot (Christophe@PathToSharePoint.com)? And do you have other customizations on your page?
      For now, a workaround would be to use another option in the formula builder (colored background or colored text only).

  65. Christophe,
    Thanks for your quick response. I’ve been chasing this one for a couple of days thinking that I implemented your script wrong. (I did.) Just after I gave up and cried uncle, I found the problem. In the edit view screen when I changed the column to display the weekly view also has a sub- heading. I’ve been only using the weekly view. I happened to click on a monthly view and the problem went away. I had changed the sub heading to display the identical column as the main heading. (All day events do not use the weekly subheading) Thanks again for your time.

    • ok, great!

      Interestingly, with this method the title is actually displayed twice, this is needed for the opacity effect. But the two displays overlap and users only see one title.

  66. This is awesome, however, since I am admittedly a novice, I have the following problem: In the DispForm.aspx view of an event after I click on it from calendar view, it has the “Color” and “Display” fields displayed with all of the code.

    Do you have any idea how I can get those two fields not to show up? When I go in to the site using MOSS Designer, it doesn’t show those fields so that I can hide them. I thought there was a way to hide the column from the site settings but I am obviously not smart enough to find that.



    • That’s a good point,and I should add this to the tutorial.

      Jordan, there are two ways to fix it:
      – add the TextToHTML script to DispForm.aspx, and you’ll see the colors instead of the HTML
      – allow management of content types, and then you can set the field as hidden.

      Search my blog and the Web for more details on these solutions.

  67. Hello Christophe,

    I would like to thank you for the great tutorial! It’s truly amazing how detailed it is, when compared to many others we find online.

    I would like to mention that maybe you could inform for those with not such a tech background in case they’d like the text color to be different that they can change the color of the text for e.g. to black by using command: “color:black” instead of color:”&[Color]&”.

    Thank you again for the great work!


    • how exactly do i get the text to come in white? we went ahead and used the solid background as oppose to the transparent but i cant get the text to come in white. Thank you so much

  68. Does the source field have to be a choice field. Is there a way for it to work using a single line of text field.

    The reason why we desire this is because we are using outlook sync and the category field in outlook is mapped to the categories field in SP by default

    • Any field will do as long as it is accepted in formulas: choice, text, number, other calculated column, etc.
      For lookup or people fields, you’ll need to use a workaround – for example have a workflow copy the value to a text field.

  69. THANKS. I’m getting all the results mentioned in this tutorial till step 3. But for some reason I’m unable to get the results for step 4 even though I’ve specified the path for the file downloaded.

    The content web editor shows the following error: Cannot retrieve the URL specified in the Content Link property. For more assistance, contact your site administrator

    Any assistance is greatly appreciated

  70. Your instructions were excellent. I got the color coding to work perfectly and all the users are thrilled with it. I have about 8-10 different colors on my calendar. Any ideas on creating a color code key that I can place on the sharepoint so that everybody can reference and easily tell what the colors represent?

  71. This is a really good tutorial. Thank you so much! However, I have more than 7 on categories, by any chance, do you have updated script for more than 7? 🙂

  72. This is just what I was looking for, unfortunately, I cannot get the rendering to work. I have tried both the .txt file and the Source Code method mentioned by Yenaii.

    I have verified my 2 calculated columns and the rendering script context, but no color. My first thougth is that javascript is locked down, but I know there are other sites that are using *.js files.

    Any thoughts?


    • Having JavaScript locked down when you work with SharePoint is unusual, as SharePoint itself relies on it for its menus. Double check if you missed a step in the tutorial.

      • I have ran through the steps at least 5 times–went through the formulas and script letter by letter to verify–still nothing.

        I even simplified my ‘Display’ formulat to see if there was a typo there. I am using =””&[Title]&”” That seems to be work.

        The Color column displays the correct colors “Black” “Red” etc

        The CEWP is below the calendar. The URL to the TextToHTML.txt file is in the Content Link. (the system does change the URL to an absolute reference) /sites/company/div/office/Shared Documents/TextToHTML.txt I have even tried copying the code to the Source Editor.

        Any other thoughts?

        Thanks, Todd

  73. Christopher, I was able to successfully use the SP 2007 Color Coded Calendar Tutorial, but in a couple of weeks we are moving to SP 2010. I tried to following you subsequent SP 2010 alternates, but I’m not quite sure what steps I need to take for the color coding to work. Do I just need to set disable-output-escaping=yes to get this thing to work, or do I need to add additional code that you have defined in III and IV?

  74. Color coding worked great. What I need to do, though, is show the originator’s name in the color bar, not the category that establishes the color. (It’s for a departmental absence calendar–idea is to show who’s absent and why on any given day.) Is there an easy fix?

  75. Created By is the one–but when I try to use it, SharePoint says that it can’t be used in a formula because it’s the wrong type of data.

    • Right, fields of type lookup or people cannot be used in calculations, this is one of the limitations of calculated columns.
      A workaround is to create a workflow that copies the field to a standard text field.

  76. I think I have followed your instructions (very good btw) – but I cannot save the web page if the cewp is below my calendar; if above the web page will save, but it does not work. BTW, I see the link to the .txt file when i edit the cewp, but no data show in the cewp. I see all the data on the calendar as in step 3 – step 4 just doesn’t seem to follow your example… I copied both the lite and regular .txt files and tried both. Thoughts? and thanks…

  77. Thank you so much! Your instructions were awesome – I was successful on my first try. I really appreciate you sharing your expertise.

  78. I received the following Message when trying to add the content web part.

    tags are not supported in the HTML specified in either the Content property or the Content Link property. You can remove the tag, or use the Page Viewer Web Part, which supports the HTML tag. The Content property can be modified in the Rich Text Editor or Source Editor. More about the Page Viewer Web Part

  79. Christophe – You were absolutely right, it was indeed my operator error. I was able to get the colors on the calendar 🙂

  80. Question – the colors are showing on the calendar. The problem I am having is when I open in item the formula for the color is in the display colomn visible to the users. Is there a way to remove so the formula will not show and the colors will still display?

  81. Hi Chris,

    great post, seems to be very popular.

    Is it possible to have multiple event types being coloured? i.e announcment and event (as default). I want several different event types to then have a choice box which i can add colour to.

    The way this is currently coded means it will not work, could the display code be change? to for example just look for any column starting color?

    • Craig, I am not sure I understand your objective. But this example is simple, the selection is based on one choice column. You could modify the formula to include more advanced color selections, based on both the content type and another field.

  82. Hi,

    I am also interested in finding out how to get rid of the extra space around all-day and multi-day events, or at the very least make it the same color as the event.

  83. Pingback: b r e n d a n n e w e l l . c o m » Colour coded SharePoint 2010 Calendar

  84. This worked out great. Thank you!

    Is it possible to have two columns appear in the calendar view? I would like for it to display the resource reserved and the person’s name reserving it. Both are columns filled out when making a new calendar entry.

    • I created a new OOTB calendar and walked through the tutorial but completing step 4 has no affect. The link to the text file didn’t work and neither did adding the code to the source editor and the same thing happened when I created a calendar using an already existing color coded calendar that had been saved as a template.

      • Never mind! I just came back from my lunch break and the calendar is now displaying as it should. Apparently a long lag time.

    • hrod: yes, you can display two or more columns, as long as the column types are allowed in formulas.
      In your case, the person’s name needs to be a text or choice field. Fields of type people or lookup are not allowed in formulas.

  85. Hi

    I am looking for adding an onclick event on the calendar which would display a pop-up with details about the calendar. Is that possible?

    • Pal: there are various ways to do this, using the same method or an additional script (for example a jQuery tooltip plugin). Search my blog, 1/ there’s an example from 2008 that could be a good startpoint and 2/ you should also find a demo of jQuery tooltip.

  86. is there a way to add more than 7 categories and colors? I tried adding to the colors calculated field and it gave me an error.

  87. has anyone found a fix to why a weekly calendar is redrawn everytime you mouse to the left or top of calendar. (if the calendar has calculations in it.)

  88. I can’t add Columns. Keeps giving this error:

    The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column. at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)
    at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd

  89. Wonderful article, and the color rendering works great!

    Some of the backgrounds do not work as well with the default Title text – can the Title text color be changed? Or better yet, can the Title text color be chosen based on Background color?

    Thanks for all of your hard work!

    • actually, I think I answered it myself.

      Under Select Your Options, I chose Apply Color To: Background. I then chose the background colors using your wonderfully easy to use form.

      I then added a calculated field called TextColor, then used the same IF formula to choose the text colors.

      Finally, I changed the Display calculated column formula by adding the TextColor as follows:

      ="<span style='width:100%;display:inline-block;text-align:center;border:1px solid &amp;Color&amp;;color:&amp;TextColor&amp;;background-color:&amp;Color&amp;;'> "&amp;Title&amp;"</span>"

      It worked!

  90. Hi Christophe, Thanks so much for this tutorial. I’m also trying to see how I can get rid of extra space and border for full-day or multiple day events.

    I saw: “Christophe
    You’ll need to modify the Text to HTML script. Instead of just overwriting the text, overwrite the parent node.”

    I would like to know how you can overwrite the parent node. Thank you for your help.

  91. When I do this tutorial once I get to the end of step 3 my calendar does not show anything ugly. In fact it only shows “no title”. Any suggestions?

      • I changed the settings from Title to Display on the many times I’ve tried this over and over. I’ve also found that after I download the TexttoHTMLlite download when I go to get the URL my webpage when I click to read only is completely blank.

  92. Weird issue here that you may have encountered. I have several users who see my calendar correctly, but one who sees the calendar incorrectly (HTML displayed)

    We both have the same browser version. Any Ideas what may cause this.


    • Jordan, no idea why this happens. Does your user have special settings, for example JavaScript disabled? Are the other SharePoint features working fine?

      • I am experiencing similar problems to what Jordan did. I can see the colors within the calendar view and it looks great. Others see the calculation from the display field. I have validated brower settings without any success. What would cause this?

  93. Hi, Ive implemented fine, however, default sharepoint behavious allows you to click on the text to bring up the edit form for an event…but since using the colour calc column scripts here, obviously that link disappears. Any way to keep the way that you can edit an event by clicking on it ?

  94. Christophe, I recently implemented the 2007 color coding out to my users, but have encountered an odd issue with the display of text on MAC’s. In IE the color coding and text display perfectly, but on the MAC’s in Firefox if the user creates an event with a start and end time, each word of the title wraps to a new line, but if the user enters an event for a full day or period of time, it does not wrap. I thought it might be because I have more than 7 colors, but whittled it back to 7 and it still does the same thing. Have you ever encountered this with Firefox users?

    • Kathy, I just installed Firefox 3.6 on Mac to check your issue. Everything seems to work fine, did you try with with my demo from the post (“May 2010”)?

  95. Hey Christophe,

    Hope all is well. I have recently starting looking into the color calendar. I noticed on the image in this post, the start time is visible, but on your live demo it is not http://www.pathtosharepoint.com/Lists/May2010/calendar.aspx?CalendarDate=5%2F11%2F2010.

    I know by default all day events do show a start time. Viewing an item detail in the MAY 2010 live demo I can see they are not all day events. So how did you hide the Time outside your color coding?


    • Honestly I don’t remember exactly. I think the easiest way is to look at the source code of the demo.
      All of this is just DOM manipulation, so all is possible: show the time, hide the time, show the time on mouseover, move the time to the color coded zone, etc., etc…

  96. Hello Chrisophe,

    I have been looking for a way to do this and I an thankful for your blog.

    When I go to step 3 there is no “display” column to select, is there an alternative that I can use? Also will this display the entire blocked time in color when using the Day view.

      • My fault for overlooking that. When I try to create a column named Display I get the following error. ( The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column. ) I did have a status column created but I deleted it and tried it again and received the same error. Is there something else I could be doing wrong?

  97. Pingback: Live demo: countdown/countup « Path to SharePoint

  98. Hi Christophe,

    I got the colors in there correctly but I have our original background color. I saw the code to remove it in the linked tutorial after yours… but I have no idea where to paste the code. Does it go in the saved file!?


  99. This was a great article. When viewing items in single day view or week view the single day items are not showing correctly. Has anyone else had this issue or known how to fix?

  100. Great Tutorial on adding color to a calendar and Thanks for the code but clearly I am doing something wrong. . .
    I have completed all the steps but I am still seeing an “ugly” calendar.
    Step 1 indicates to: “right-click on the last file name TextToHTMLlite-v2.1.1.txt, and select – save target as… to save it to your computer”.
    Maybe it is supposed to do this (I am new to all of this. . .) but when I “save as target” your .txt file gets converted into an .xlm file. Then when I enter the URL for the .xlm file which is saved in the document library all of the information in that .xlm file shows in the content editor web part. Can you PLEASE give me guidance as to what I am doing wrong??

  101. So close! All is good except the ‘text’ that displays is the respective category names I made (e.g. HR, IT, Finance, etc.), and not the calendar appointment title (e.g., status meeting, project 123 update, etc.)

    How can I switch to display the calendar item Title? Thx!

    • Never mind, found my error 🙂 Needed to put ‘Title’ in the Displayed Column field back in step 1. Great info everyone…

  102. Color coding the calendar in “calendar view” works great. Is it possible to color code in “list view”?

    • I wrote the tutorial for calendar views because it is the most frequent request. But actually the same technique will also work on other views (except th datasheet view which is not html).

  103. Hey Christophe,

    This is a great enhancement!

    Is there some simple way that this could be extended for the lookup column types also where the number of entries are less than 7?

    I have a requirement where I want to use your colour coding scheme for a lookup column type. Please suggest a way forword for this.
    Best Rgards

    • Do you mean more than 7? See the link in the tutorial.

      As for lookups, a workaround is to use a workflow that will copy the content of the lookup column to a text column.

  104. This is working great! I would like to know if it’s possible to make the entire entry the same color? I will be using the daily view the most and my entries will stretch over hourly time frames. It would be good if I could get more than the title in color.


      • Christophe,

        First of all, your site has been an unbelievable resource to me for the past couple years. Any time I need to do any fancy customization, I come straight to your site. Thank you very much for your work.

        I hope you can help me out with this. I think I am having the same issue Ron has mentioned. Everything works properly. I have even been able to customize the code to modify the text color and background opacity. For my week and day views I’ve created a “Display Location” field and applied the same formula to that so my locations show with the correct background color. However, if I have an event that spans multiple hours, only the Title and Location has the colored background. The remaining block has no background. I’ve included “height: 100%”, but that doesn’t seem to make a difference. Any thoughts?

  105. great tutorial! i followed all the steps but all the colors are still gray. i don’t see a way to select the fields [tied to the color choices] i created from step 1. when i open any event in the calendar, the “status” drop down menu is the default list and the “display” category is on code. i read in an earlier post that you recommended the user “- add the text to HTML script to the dispform.aspx page, then it will render the same way as in the calendar view.” will this fix my issue, and if so, how do i do that? thanks for your help!!!

  106. I am trying to add the completion date after the title within the calculated field that I am displaying in the view… Anyone have any idea how to convert the format so that 40574 (Which is how it displaying now) shows as 1/31/2010?

  107. One word: AMAZING! This is so simple and easy to implement and I had been searching for quite some time for EXACTLY this to make it easy to color code 6-7 categories of activities.

    Many thanks!!!

    If I can ask, is there a way to make the font NOT bold when using semi-transparent background; I find that it make it hard to read.

    Again thanks and EXCELLENT work!!

    • Thanks 🙂

      The beauty of this method is that you can use HTML, CSS and even scripts in the formula, to address your specific needs. You can modify the styles, include icons, add tooltips, etc.

      In your case, see if this works:
      in the formula, replace:

  108. Christophe, once again your scripts have helped me tremendously. Your color coded calendar is exactly what I was searching for. I do have one question and I hope you can help. For better readability (we have lots of entries on one date and it is confusing to read), is there a way to include the start time in the color block? I had created a summary column to display but cannot figure out how to include the start time. Of course if I include it there, I have to stop it from automatically displaying in the calendar, or it would appear twice.

    This is my Summary column formula that displays in the calendar: =”to “&[Event Time]&” “&Reservation&” #”&Number — It pulls another formula from the Event Time column: =TEXT([End Time],”h:mm AM/PM”). The Reservation column is the same as your category column.

  109. Help

    eveytime i try to create the column’s i get the following error

    The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.


    • 1. you need to first create a column [in this example it is called “Category”] of type “Choice” with the number of your categories as choices, then list them each on a line.

      2. you need to refer to that column when using the “online form” to generate HTML code

  110. Pingback: 如何向 sharepoint2007 日历中添加颜色 | CS Magazine

  111. Hi Cristophe,

    This is a great Tutorial! I am currently wroking on a meeting room reservation calendar with just default settings and I just followed your steps with some modifications on the calculated column and viola!

    I do have a question though, the color does not apply to the entire blocked sched. It just displays it on the in-line text. I also sent some screenshots to your e-mail for details.

    Hope to hear from you soon! 🙂


  112. this is really easy thank you so much for the help. have just one question we needed our colors to be the solid background as oppose to the transparent and we got it to work but how do i make the text white so that we can see the text.?

  113. What part of the display code can I change so that the font for all options stays black instead of being the color?

  114. Hi Christophe,
    This isn’t working for me – it seems like it’s getting stuck in step 4. I see the HTML code on the calendar instead of the colored title. I’ve triple-checked that I have the link in the right place, and when I go to check the link it seems to be working (it just gives me a blank screen) but that’s what it does when I click on the text script directly in the library. Please help! It looks like this would be really amazing if I could get it working!

    • Hi Sarah,

      I was having the same issue and I fogured a workaround to execute this step. What I did was the following:
      1. I went to Share Point Document library site I saved the txt file. I clicked on “edit Document” and copy the script/ When you click on edit the document the file will open oppose to the way we were doing by just clicking and having a blank screen.
      2. Rather than click “Content Link” and type the URL, I clicked on Source Editor and pasted script into the text entry webpageDialog.
      3. once you click save, you will see the script in your calendar entry turn to the display color.
      4. Click apply and exit the edit mode and your done
      Let me know if you still have any issues and I will give you my email address and I can send you a print screen with the workaround
      best of luck

      • Both pasting the code under Source Editor and linking to the txt file should work. The latter is recommended as you only save the script once in your site collection.
        Matt P, do not point to the original file, it won’t work. Instead, save a copy to a library in your site collection, and point to that copy.

  115. Hi,

    I have a problem in Step 2. The formular must be wrog, because there is a warning. We use Microsoft Online Services Sharepoint in the german vision. Had anyone an idea?

    Thanks for help!

  116. Hi, thanks a lot for this tutorial. It works perfect and the step-by-step explanation is perfect.

    Just one little question. Is there any possibility to hide the new “Display” column if you display one event?

    Thanks for help again. Greetings from Germany.

  117. I stumbled across this article looking for a way to color code my Gantt charts. It took me longer than 15 minutes…probably because I didn’t carefully read/evaluate the steps. But it works and looks great! Thank YOU!!! Laura-HP

    • Hi Laura – I would love to learn how you color coded your Gantt charts if you have time to post. I am close (have the display column showing the color coded bars . . . but not the bars of the Gantt itself).
      Thanks in advance!

  118. I’m experiencing an issue when I open the Content web editor and linking my saved txt file into the Content Link To link to a text file, type a URL..

    I have saved the file on my SP site as a document library and when I click on the file the browser has a blank screen.

    Any ideas to fix?

    Thank you

    • When you test the link you are running the txt file. It works if your result is blank. Click OK and you should be fine.

  119. Hi Christophe,

    I am following all the steps and it’s a really good tutorial but I still cannot make it work my site is giving me an error when adding the calculated columns, it says “One or more column references are not allowed, because the columns are defined as a data type that is not supported in formulas. ” what should I change?

    Thanks 🙂

  120. Hi there,
    Fantastic work – much appreciated.

    When I go to test the link in the content editor I get an error telling me that ‘ExpGroupRenderData’ is undefined 😦

  121. Hi,

    I have a custom list and my Choice column (for your form) is a calculated Column – single line of text- , results in “COMPLETE”, “IN PROCESS” and “NOT STARTED”.

    I am getting following error:
    Error:The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.

    Is there a way to fix it?

    Thanks in advance.

  122. Hello, I am very excited for this to work, but, after I paste the code into the source or link the text file, I exit edit mode and still see the code… I’m not sure what I’ve done wrong?

  123. Thanks for the tutorial it has worked great, I am hoping you can tell me how to modify the code in the display forumla to allow all the text to be in black and only have the background in colour. i am fiding the words are getting losts as they are the same colour as the background


    I have been using this method for over a year now and it is truly a terrific addition to our sharepoint calendars. Recently looking at how to remove the default time of 12:00AM and in searching the net found tricks that work, but not with the color coding script. After tinkering a while I discovered you can modify the displayed text within the color code script at the line:

    theAs[i].innerHTML = AContent;

    If you substitute:

    theAs[i].innerHTML = AContent.replace(“12:00 AM”,””);

    the default time disappears — voila!

    I guess, you could use other string manipulations to get rid of all time references too.

    Thanks again for your great help.

    • Hi Peter, I can’t find this line in TextToHTML.txt script. Can you show me where to find and modify it as I want to hide the time of calendar items.


  125. Good stuff! Everything works except I get “Cannot retrieve the URL specified in the Content Link property. For more assistance, contact your site administrator.” on the frontpage. .. like “Sanjay” listed in the comments above. I, unfortunately, haven’t been able to resolve error on my own.

    I tried the stuff you recommended to Sanjay before he corrected the issue himself somehow. Permissions, URL/location,etc. all seem to look fine!

    Plus one more ‘easy’ question: If you click on a calendar event and look at the description/details – Display info, i.e. “ugly” code, is listed. I figure there’s a setting somewhere where I uncheck display to be listed within the event details but I can’t seem to navigate to it.

    Any help is GREATLY appreciated!

  126. This works great, thanks for the tutorial. It was very easy to use. Can you do a sort by the categories you use in the calendar? Example: all the category one entries will appear at the top of the day? I am using all day events and certain categories should be at the top of the calendar day. The order now is as they are added. Is this possible.

  127. It works for me. Thank you soo much. Just one query ?? Is that anyway I can make the font of titlle in balck and rest background in color??


  128. Hi Christophe, this works great. I have a question, however, about checking the value in different columns. I want to set up a system where users can reserve laptops/projectors, and color code it based on what they chose. So I want to make laptop rentals aquamarine, projector rentals gold, and both green. This involves them using 2 different pull-down choice menus. Is there a way to check both? I want to avoid having them choosing from those 2 menus, then having to again set a third pulldown menu (mostly because they probably won’t).

    I tried the following:
    =IF(AND([Laptop]=””,[Projector]=””)),”White”,IF(AND(IF([Laptop]=”Laptop 1″,[Laptop]=”Laptop 2″,[Laptop]=”Laptop 3″,[Laptop]=Laptop4″),[Projector]=”Projector 1″,[Projector]=”Projector 2″)),”Green”,IF(AND(IF([Laptop]=”Laptop 1″,[Laptop]=”Laptop 2″,[Laptop]=”Laptop 3″,[Laptop]=”Laptop 4″),[Projector]=””)),”Aquamarine”,IF(AND(IF([Projector]=”Projector 1″,[Projector]=”Projector 2″),[Laptop]=””)),”Gold”

    I keep getting a syntax error on this, however. Any suggestions??

    Thanks again for your great site!

    • Nevermind, figured it out!

      =IF(AND(Laptop=””,Projector=””),”White”,IF(AND(OR(Laptop=”Laptop 1″,Laptop=”Laptop 2″,Laptop=”Laptop 3″,Laptop=”Laptop 4″),OR(Projector=”Projector 1″,Projector=”Projector 2″)),”Green”,IF(AND(OR(Laptop=”Laptop 1″,Laptop=”Laptop 2″,Laptop=”Laptop 3″,Laptop=”Laptop 4″),Projector=””),”Aquamarine”,IF(AND(OR(Projector=”Projector 1″,Projector=”Projector 2″),Laptop=””),”Gold”))))

      That’s the correct syntax

  129. The tutorial worked great. I can see the colors on the calendar I created but no one else can. They can see the calendar and titles but no colors. Did I do something wrong?

  130. I cannot move as described below:
    – drag and drop the calendar view above the Content Editor Web Part (the order is important)
    I’ve tried the advice provided on the earlier post.
    In my Calendar Web Part Title, during mouse over, an underline shows but cannot move it anywhere. ?

  131. thank you very much for the great tutorial. when i look at my calendar though i see #value! is something wrong with my formula? do you know of an easy fix?

  132. Help!

    I have used this method and many of the others on our old sharepoint 2007 webs with major sucess. However now in our new 2010 environment i am stuck. I am unable to create the calculated colunm as it is giving me “The formula contains a syntax error or is not supported.”

    ***=” “&Title&””***

    I have tried changing the regional settings from Swedish to English but nothing seems to help!

    • The formula was generated using your sharepoint tool kit. I have tried options for the displayed html using the tool kit options but nothing seems to work.

      I have been able to verfiy that i can get formulas to work on my task list by adding a simple data and status checker: =IF([Issue Status]=”Done”;[Date Done]-[Due Date];””)

      So is it the span style stuff that 2010 does not like?

      • Calculated columns have not changed from SP 2007 to SP 2010, and the same formula you used should also work on the new site. The only part to change is the Text to HTML script.

  133. Brilliant work here. I’ve been trying to figure out how to set this kind of thing up for a long time. Now, I have everything working as advertized on Sharepoint Foundation 2010.

    Of course, I can’t let it rest there! I’m trying to get tooltips to work so that they’ll display the category rather than the html when you mouse over the appointment. I thought I’d just be able to use the title element on the tag, but it doesn’t seem to be working. Here’s my Display column formula:

    =” “&[Student Name]&””&[Student Name]&””

    Am i missing something?

  134. Looks like your site killed my formula let me try once more without the brackets:

    =”<span title='”&Categories&”‘ style=’position:relative;display:inline-block;width:100%;’><span style=’width:100%;display:inline-block;text-align:center;border:1px solid “&Color&”;position:absolute;color:”&Color&”;’> “&[Student Name]&”</span><span style=’display:inline-block;width: 100%;background-color:”&Color&”;text-align:center;border:1px solid;z-index:-1;filter:alpha(opacity=20);opacity:0.2;’>”&[Student Name]&”</span></span>”

    • Nevermind… I figured it out. I had the title tag at the wrong place at first. The code above is actually my corrected version and it works perfectly. Thanks again for all your hard work!

  135. Thank you for the great set of instructions. I was tasked to add a calendar to my director’s Project Tracking Dashboard and found this to fit the bill perfectly, with only a few tweaks. I created a separate page and inserted calendars for each of our organizations (6 in all). The hardest part was figuring out how to shrink a calendar so I could put them into a 2×3 grid. Each employee can go to their org’s calendar, use the drop down menu to select themselves, optionally use the Title field to add additional content if desired.

    Since I have multiple calendars I could spread the employee’s out and could reuse colors without too much difficulty/confusion. Knowing how to go beyond 7 selections was a real plus though, and so easy to boot! The only “problem” is that the background color does not extend if a person’s name and additional information doesn’t wrap around. The text retains its color, but only the top row has a colored background. This primarily happens if the event/vacation isn’t set for an entire day. These are the basic steps I used:
    • Named my Choice column “Employee” .. Included HOLIDAY as a choice option with the color Black
    • Inserted “&Employee&” before the first instance of “&Title&” in the calculation field for the “Display” column.. Employee always shows, as will Title if anything is placed there
    • Made the Choice column required and Title optional
    • Reordered the Columns to make Employee #1 in the New Item form
    Next on my list is to figure out how I can set the color calculation (and hopefully the choice fields to) reference a separate list for their values. Then I can have the respective managers add/delete/configure employees as needed.

  136. Thank you for that toutorial!
    But is it possible to use the “Approval Status” instead of an new choise colum? That would be amazing.

      • But that field is not a column we create, it’s already present in any task form.
        Tried making the code based on the Aprroval Status field and I’m getting some erros.

  137. Excellent article, and everything appeared to be working fine for me. I added the Content Link to the TextToHTML-v2.1.1.txt file in the CEWP and my appointments had background colours (only white which was my choice 0 for the background colour) – i know the background is white anyway, but it still stood out against the grey when i was viewing July’s calendar but could still see the end of June’s appointments on a grey background). But as soon as i exited eiditing mode, the background colours disapeared.

    I’ve also changed a few appointments to ddifferent categories and when i go back into editing mode they are just white, not red/green like they should be.

    It feels like i’m so close but not quite there. Do you ahve any suggestions as to what might be happening?


    • Are you on SharePoint 2007? If not, v2.1.1 won’t work and you need to follow the instructions for SP 2010. In any case, make sure you position the code below the calendar.

  138. Hi Christophe, thanks for the fast response! I’ve just fixed it, in stage 3 i hadn’t changed the month view title from “title” to “display”.

    Thanks for your help.

  139. Could you please tell me how to modify the script to hide the time for each item displayed in the calendar.

    Thanks for your help

  140. Hello Christophe, Could you please tell me how to find the content Editor Web Part in MOSS 2010. Following are the steps I tried..

    Site Actions -> Edit Page -> Add web parts

    do i need to Active anything under site collection Features?

    Regards in advance,
    Avinash K S

  141. Hi Christophe,

    I know you have heard it hundreds of time but thank you for this it’s great. I too have pushed the color code to as many columns as possible. Be that as it may, when applying it to the Start and End time my values come up in decimal like this:
    7/9/2011 11:59 PM now looks like 40733.8326388889
    I have tried several times and ways but nothing is doing it. Please help

    Thank you!

    • By default, dates are stored as a number of days. You’ll need to use functions like Year, Month, or the powerful TEXT function, to convert them to other formats.

  142. Hi!
    I need i litel bit of help. The formula contains a syntax error or is not supported, WSS 3.0, says. Maybe I’ve forgot some setting for the list? Wich setting should I use for when creating the “Color” column? I have Slovenian version of Sharepoint is this a problem? I really need that color calendar 🙂 thanks for help

  143. I’ve almost got this working. However, I use Telerik RadEditor for Moss as a content editor. and I can’t figure out how to add the TextToHTMLlite-v2.1.1.txt file to the page to complete the process. Any suggestions?

  144. Everything worked great, except when I look in the Calendar Item the Display column shows:

    ” Mission XYZMission XYZ ”

    is there anyway I can get rid of this?

    • so apparently the code pasted as what it is in my calendar, weird….hmmm.

      but this is what i see when i open the calendar item.

      ” “&[Title]&””&[Title]&””

  145. Hi
    Nice article thanks very much.
    Works great.
    My only problem is that when I click on the item to view them in detail (I’ve made a change control calendar) the two columns can be seen and loom ugly. They don’t appear when creating new items only after when the item is saved.
    Can the columns be stopped from appearing in this way, have I done something wrong?

    Many thanks for your fine work!!!


  146. This is my new favorite trick in SharePoint! 🙂 Thanks for the great instructions. I had a bit of trouble; but it was only because i didn’t change the order of the webparts (calendar & cewp) on the page.


  147. Dear Christophe!
    This tutorial is amazing. I had a new team calendar up and running in 20 mins in a format that nobody had ever seen before. I am not colelcting all those cudos for me- but would like to pass them onto you now.
    Wouldn’t have been able to do it without you!

    One question … I have read through your blog – but could not find a hint as to the font size. The original format had all letters in my calendar view in bold fonts – now a few show up as bold – and a few show up as normal. Has this come up ever before? Everything else works just fine – I followed your each and every step and I am working with SP2007.
    Kind regards,

    • Thanks for your message Eva 🙂

      Unfortunately I don’t have an explanation for the font weight. Obviously I would expect all the letters to be displayed the same way…

  148. The system I am trying to use this on has no connectivity to the internet. So I had to manually type the information into the calculated columns. So my next step was to create the file TextToHTMLlite-v2.1.1.txt manually on my system. First thing I noticed was that there are references to websites microsoft etc in that file. So before I retype all of this information to create the file I wanted to make sure this would work on a system that has no access to the internet. Thanks.

  149. the txt document that you say to save to my SP doesn’t open as anything so when i add it as the content link nothing happens, any suggestions?

  150. Hi,
    I’m using your tiny calendar code and the color is not showing when I follow your steps above. Do I need to do something else?

    • The tiny calendar css and the text to html script should be compatible on SP 2007, so I don’t know why it’s not working for you. btw the calendar won’t be really tiny if you display items.

  151. This is awesome and so easy to use! My co-workers are impressed that I was able to find a way to do this. Thank you, thank you, thank you.

  152. Hi Christophe,

    Is there any way to delete/hide the default start time?
    I found a script to do it, but everytime when I upload your TextToHTML file and link to a CEWP, the script doesn’t work anymore.

    I would love to know how to solve this.


    • Ben, see if any comment above could help, as you’re not the first to report this issue.
      I would expect your script to work if it is applied first, before Text to html makes any change to the page.

  153. Christophe,
    Thanks for the excellent tutorial.

    One enhancement request: when you hover over a colored calendar item, the tooltip displays the ugly code. Is there a way to suppress this and make it just show the data, as it does in the default view?

    Thanks again!

  154. Christophe,
    This is excellent Tutorial that I have found on the net.
    Excellent way of explaination and very simple to follow.
    Request you to help me develop a Team Management with sharepoint something like Resource allocation,Shift management.etc.

    If you can contact me at getjaleel@gmail.com

    Thanks Once again

  155. This worked great for me…Thank you so much.

    I would suggest to anyone that is having issues with the link to document to open the txt file in notepad/wordpad and copy all text between the and tags…don’t include the [] used by the CDATA tag. Then open the CEWP editor, not richtext editor, and paste the code. This works for me…and I prefer not having an extra file to have to keep track of.

    • Two reasons why I recommend the external file:
      – your method will not work in SP 2010, as the code will be modified when saving the page
      – managing the code in a central place is easier (if you reuse it on multiple calendar views)

  156. Hello! I’m seeking to color code my SharePoint site, but am having problem (I’ve followed your steps exactly).

    When I go to add the “Display” calculated column, I get an error. The error reads “The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.”

    I’m sure this is an easy fix, but would love any insight you can give.

    • I just figured out what my problem was. I forgot that I changed the ‘Title’ column name for my teams purposes.

      Thanks so much fo the great article.

  157. I am having the same issue as a few way back at the top of this thread:
    Default Use for formatted text, tables, and images. true Right 2 Normal true true true true true true false Modeless
    Cannot import this Web Part. …etc..
    I have gone over the instructions again and again, but I cannot see what I have done wrong. I have linked to the txt file.

    • Christophe,
      Ok, I had to use the last file (TextToHTML-v2.1.1.htm saved as .txt) not the Lite version. Now it works great. Thanks for the information.


  158. Christophe,
    When I test the link to the TextToHTML-v2.1.1.txt file, I get an error that states “ExpGroupRenderData’ is undefined (Line: 29)
    is there an edit that I need to do to this file to make it work?

    • Getting an error with the test is normal, as the script is not supposed to run as standalone.
      If you still get the error on the page, try using the lite version instead. For the record, ExpGroupRenderData is for grouped views, it doesn’t act on the calandar.

  159. I am at Step 2 Create Column: Calendar I enter the name of the column, Color. Then I paste in the formula. It is asking for a selection under Insert column, which I don’t really understand. If I then click ok, I get an error message:

    The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.

    • What do you mean by “it is asking for a selection under Insert Column”?
      As for the error message, make sure that when you filled out the form you used the correct name for the choice column. It is called Category in my tutorial, but yours might be different.

  160. Hi,

    I’ve gotten stuck at step 2- Create your calculated columns. Please help.

    My choices are in a newly created field called “OL” with the choices option.

    When I try to create both the “Color” and “Display” calculated columns I get the following:
    The formula contains reference(s) to field(s).
    Troubleshoot issues with Windows SharePoint Services. ”

    Of course it contains references to fields how else would it know where to look to calculate the info?
    =IF([OL]=””,”Red”,IF([OL]=”United Kingdom”,”Orange”,IF([OL]=”United States”,”GreenYellow”,IF([OL]=”Australia”,”DodgerBlue”,IF([OL]=”India”,”Yellow”,IF([OL]=”Singapore”,”MediumSlateBlue”,””))))))

    How can I save the columns as calculated fields if I can’t reference the column?


  161. Oh don’t worry… always the way you ask for help and spot the problem.

    My create a new column I didn’t select the (create from existing field) option

    Doh! Sorry.

  162. This was great – thanks very much. I have a question: I have the calendar also set up as a webpart in another webpage. Following the same steps and placing the webpart with the code reference in it following the webpart with the calendar works but when I print the screen only the colorized elements are printing out – none of the calendar dates etc. It works fine if the calendar is not placed as a webpart in another page. Is there an easy solution to this?

  163. Doesn’t seem to work with Calendar view on a Form Library (InfoPath). Not sure what the difference is between a regular Calendar and a Calendar View.

  164. Hi Chris
    I was finally successful in getting the colours on my full calendar but the colours are not showing in the tiny calendar when I move it on my homepage. The ugly result etc is what is showing in the tiny calendar. The code is also from you.
    /* Tiny Calendar */
    /* Christophe@PathToSharePoint.com */

  165. I thank you so much for writing this tuturial. Work like this is greatly appreciated.

    I am having an error. On the CEWP, I get the error ” tags are not supported in the HTML specified in either the Content property or the Content Link property” Then it says to use the Page Editor Web Part instead.

    Can you help?

    • This sounds like you are on a SharePoint where the standard Web Parts have been replaced with custom ones. I’d recommend to check with your server admin.

  166. This works great when in Month view. The Day and Week views have the color but the text is cut in half horizontally. Can this be corrected?

    Also, I had a calendar on the “main” page and also a calendar under lists. Is there a way to get the color from the lists calendar to show up on the main page ?

    Thank you for your help! This tutorial is great!

    • Glad to help!

      You’ll have to apply the procedure to all the pages where you want color coding. And I don’t have an easy solution for the cut text. It is not due to my solution, it behaves the same in the default SharePoint view.

  167. Everything worked great… When I click on an event in the calendar, in the next page the two fields “Color” and “Display” show up with the “Color” field showing a color and the “Display” field displaying code. What do I need to add to the code to make this code not show up, and or how do I remove these to fields from the event display?


  168. I tried looking through the comments above and didn’t see anything related. Is there a way to change the font color so that it’s not the same as the background color. we have successfully added colors to our calendar but have some users who are having trouble reading the font. Or are there other ways to increase the contrast between the font and the background?

  169. The only words I can say is AWESOME, I have never seen a script to be deployed in just 9 minutes to achieve a custom goal. Thank you very much for sharing this with us. This article is easy to understand and easy to deploy, most of the time it takes from 9 minute is color selection. Rest everything is done in less than 2 minutes. Thanks again 🙂

  170. Hi Christophe,

    I am following all of the steps above and think I am having trouble with the link from the downloads tab. Is this link current? Its not displaying when I click on it. I downloaded it anyway, and followed the rest of the step. I get an error “Cannot retrieve the URL specified in the Content Link property. For more assistance, contact your site administrator.”

  171. Pingback: Calendrier Couleur « Mon SharePoint

  172. I followed your directions and everything goes smoothly until I add the web part and then the rendering is off. It turns all my titles into flat black lines with no content. The HTML “mess” displays fine before I add this web part so I feel like it’s an error in the code somewhere. I’m using the full code, the last one on the download list. Any idea what might be wrong?

  173. Hi Christophe, I was able to get the color working on my calendar for items that were approved, rejected, pending, by using a workflow to copy the Approval Status lookup to a separate field (StatusType). However, I just noticed that the actual Approval status is no longer getting updated. If I change an item to go from Pending to Approved, the StatusType gets updated as does the color, but the Approval status remains Pending.
    Do you know why this would happen?

  174. Everytime your workflow sets the StatusType, the item is changed and reverts to PENDING in ApprovalStatus. I speak from experience on this.

  175. Hi

    Did someone tried to use this on the real calendar page ?

    …/Lists/Calendar/calendar.aspx I cannot place there a CEWP with JS, so how to do it without modifying the page in SP Designer ?
    Is there a way to place the code somewhere ?

  176. CHRISTOPHE, I am not getting the “ugly result” after doing step 3 and subsequently nothing works right. I followed your procedures step by step. Could you help me? Thanks

    • Well I got the calendar working, only problem is there is a border around each event that I can’t get rid of. I unchecked the Draw Border box and pasted the new formula but that didn’t work. Any suggestions?

  177. It is very usefully approach, thanks Chirs…
    im getting image and color in when an item is added in calender, but the Title is overlaping the image, when an new item is created for a single date column. i want image and title cant be overlapped. how can achive this.. any ideas..

  178. Thank you very much Christophe!
    Nice how-to. A little more thinking from my side and it went just the way I wanted. Thanks for sharing this great staff with us. Here is my 5 cent:
    I used “Yes/No” form (tick) to mark if an event is approved (green color) or not (red color)
    So if the form is called “Approved”, the formula for color looks like:

    • Well done, nice and clean! I usually prefer creating my own Yes/No choice rather than the out of the box one, but in this case it works great.

  179. Pingback: SharePoint 2010 Colour Calendar post SP1 update | Software

  180. Thanks so much for this, Christophe! This is exactly what I was looking for. Everything is working great on the calendar. However, I also have a calendar list view on my home page showing the upcoming dozen or so items and although the color coding works fine on that, I can’t click on a calendar item and have it bring up the edit screen. I have to actually go to the regular calendar view and then I can edit an item but not from the list view. I do get the hand icon when I mouse over an item on the list view, but it doesn’t do anything when I click on it. Is there a way I can have it do this? It’s not a huge issue to my users but it would be nice if it linked back to the item as it did prior to the color coding. Thanks much!

    • Sorry Lynette, I have no explanation for that. If you followed the exact same steps for both calendars, I would expect them to have the same behavior…

  181. Christophe,
    Any reason you know of that the color rendering is fine on all my machines, but one. And it is a specific account – it works with other accounts on this machine?? As far as I can tell, everything else works for this user?
    XP – IE8.


  182. Hi Christophe. First off, thanks very much for this blog/script/guidance. Very cool. I have some questions and a comment:

    Question 1 – I have a total of 12 items that I want to color code, but for some of them, I actually want them to have the same color (i.e., Items 1 through 4 should all be green, items 5 through 8 should all be red, etc.). Do you know if it’s possible to modify the formula that goes into the Color column as follows (ignoring the fact that I may be missing a parentheses or two):

    =IF(OR([Item Type]=”Item1″,[Item Type]=”Item2″, [Item Type]=”Item3, [Item Type]=”Item4″),”Green”,IF([Item Type]=”Item5″,”DarkCyan”,IF([Item Type]=”Item6″,”DarkRed”,””)))))))

    Question 2 – If the above wouldn’t work, do you know if it’s possible to make the Category column (i.e., the choice column) a calculated column instead, and have the calculated value be determined from the already existing choice column that I have in my calendar (and for which the items referenced in question 1 are already in place)?

    And the comment – not really sure how long this is going to take me, because it’s already taken me a day to realize that, for some reason, the color setup .aspx page for step 1 wasn’t working in my IE9 browser. I finally figured out what I was supposed to do, fired it up in Chrome and, voila, the magic happened. Obviously, I’m not the brightest bulb in the package, so you can’t really gauge the accuracy of your time projection by me 🙂

    Anyway, thanks again, and interested to read your thoughts on my questions.

    • Ah. Never mind. I realized two things:

      1. The text2HTML script doesn’t work in SP2010, and
      2. If it did, I could just as easily have done something like:

      =IF([Item Type]=”Item 1″,”Green”,IF([item Type]=”Item 2″,”Green”,IF([Item Type]=”Item 2″,”Green”,IF([Item Type]=”Item 4″,”Green”,IF([Item Type]=”Item 5″,”Red”,IF([Item Type]=”Item 6″,”Red”,””))))))

      etc., etc., etc. And if I needed to go over seven, I could just concatenate as you explained in another post.


        • Chris, it’s definitely good to have other options, and Mark Wilson’s one is worth a try. I’d just like to point out two issues you need to be aware of:
          – the color rules are hard coded in the script, which means that you need a different script for each calendar
          – the code overwrites some default SharePoint scripts and this is NOT a good practice. If you follow Mark’s blog you might have noticed that he had to update the code for SP1.

          I think it’s also important to understand that my solution does much more than color coding. In 2010, I wrote a post – “Don’t take my solutions at face value!” – to explain that my tutorials are just the start of your journey!

  183. Hi Christophe. First off all, thanks for this blog/script/guidance. I have a weird problem, evreything is working great, until I’m closing the webpage. when I open it again, I can’t see the colors anymore. If I’m going to the settings page, under Views, and just clicking ok, the colors are appearing again.
    thanks vered tal

  184. Pingback: SharePoint 2010 Calendar – Resources « Mastering SharePoint

  185. Hi Christophe,
    Absolutely brilliant tutorial. I spent more than 15 minutes on it only because I was having so much fun!
    I do have a question, though: I see how specifying the “display” column makes it clickable for editing the entry in the “Calendar” view; can this be done in the “List” view? I have hidden the “Title” column and moved the “Edit” column next to the nicely colored “Display” column, but it seems it would be better UI to have some consistency in function and have the Title clickable.
    Thanks for your great work!

    • This is the same issue I’m having. Thanks Chris Foleen for mentioning the Edit column. I hadn’t noticed that column before and it’s a good workaround but I agree that it would be great to be able to just click the item in the Display column.

      • The issue here is that you cannot include the item id directly in a formula. And if you don’t have the id, you cannot link to a display or edit form. There are workarounds, but using the edit button seems like the right approach.

  186. I have done all the steps as you outlined but my calendar still shows all the garbled information in my display column.

    CHG8260 Child ticket for Wheeling BDP sites RTR upgrade & VWIC card installationChild ticket for Wheeling BDP sites RTR upgrade & VWIC card installation

    I copied the text to TextToHTMLlite-v2.1.1.txt script and still not working.

    I have tried a few of the other links but no success. I’m using Share Point 2010.

  187. Hi Christophe,

    Thanks for putting this together for us to leverage. It looks great. I am getting the same error message everyone else is when they I try to create the “display” column in step 2. It says “The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.” Its funny because the first formula worked totally fine? Do you have any suggestions?

    • Hi Jason,

      I had this problem before because us Europeans (Irish!) spell the word colour and not color, you may need to change this text part in the display script Christophe mentions above.

  188. Hi Christophe,

    I’m using SP Foundation 2010 and can get the colors to show when displayed as a list but not in the actual page webpart. Any reasons why?

    Thanks for your help!

    • Paul, remember that the script is applied to a page, not a list. If you need the color coding on multiple pages, you need to insert a CEWP in each page and link the script to it.

  189. Hi Christophe,
    Thank you for your reply, yes I did figure that out, it looks fine. However, when two events are entered on the same date, the title is right oriented and truncated. Have you noticed this and is there a work-around?

  190. Thank you so much! Got it *almost* working. Am trying to display different colors bars in my gantt chart based on Project Type column. Am using ‘gantt view’ OOTB in SP 2007 wss. I see the color coding in the list portion of the view (lower half of screen) but not in the gantt portion of the view above. Any idea how to get the bars in the gantt portion to change colors? Is it a change to the .txt file somewhere, perhaps? If so, would appreciate explicit instructions (I’m not an html expert). Thanks again!

  191. I am having problems with the txt file. The format of the files in the download tab are .htm or or .dwp. I tried opening the file then coping all of the data into notepad and saving as a .txt file. I saved to a SharePoint library and tried to open and I recieved an error message “The XML page cannot be displayed”. I am obviously doing something very wrong…what??

    • I don’t think you’re doing anything wrong, that’s just the usual behavior with SharePoint libraries, What you need to do is manually change the file extension from .htm to .txt in the download window.

  192. I have used this process to color code one sharepoint calendar and am working on a second.

    It seems that the color coded view breaks evens that have a reoccurance. Is there a fix to this?

  193. Great walkthough thank you, however the text back has been filled in with the background colour dispite the display code having it in it.

    What I have is: =” “&Title&””

    What am I doing wrong? Thanks guys

  194. Great walkthough thank you, I have selected a colour for the calendar entry to be filled in but the colour display shows only the outline of this entry.

    I have also selected this background fill option in the intial fill out form.

    What am I doing wrong? Thanks guys

  195. Hi Christophe,

    Everything works great! One thing that may be a mistake I made in setup…when you click on the event after it is added the Display column/field shows the code. Is that the way it should work? I’d just prefer not to show that column/field at all if possible. What did I miss?

  196. Hi, Christophe,
    Great tutorial (as everyone else says!), so thank you for this. I’ve been tweaking your code to get a DataView WP to display my calendar as a year view with your colour-coding working in it. Still not quite there, but if you like I’ll send you the code when I have it working …
    Thanks again.

  197. Sorry if I missed a reply to a similar question (that I thought I posted – maybe I didn’t).

    Question: does the calendar need to begin life as a Calendar style list? or should this be able to be applied to a list that contains dates, that you subsequently might use to create a calendar view?

  198. Pingback: Using colour coding to receive Alerts

  199. Hi, I’m using your tiny calendar on a team site. However, whenever an event is added, the columns get skewed. Is there a way to just highlight just the calendar date and then it can just be clicked on to view the event/meeting?

    • The simplest solution I can think of is to create a column that just contains one character (“.” or “x” for example) and use this column for display in calendar views.

  200. Hello,

    I am not SharePoint savvy in any sense but really want to colour code my calendar so have been following this guide to the letter. However I have run into difficulty on step two with the calculated columns and recieve this error message when adding the second column: The formula refers to a column that does not exist. ‘Check the formula for spelling mistakes or change the non-existing column to an existing column’

    If there is someone who knows what I am doing wrong and could let me know it would be appreciated!
    Please bare in mind that you may have to dumb down a response!
    thank you!


    • Over the years, many users have reported similar issues, and in all cases SharePoint was right! Double check the spelling of your column names, and remember to put the name under square brackets if it includes a space (for example [Due Date]).

  201. Pingback: Trick or Treat? Text to html, the wicked no-code way « Path to SharePoint

  202. I have a Column that isnt a choice column, I have a column called Segment there are six items for that, When I use your tool I only get the code, the last step doesnt convert the code I see the span etc…… what could be wrong, or does all of this hinge on a Category column??? What do I need to do to use your Color coding example?

  203. when i try to use it in sharepoint 2003 i get the error
    “The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.”

    please help!!!

  204. christophe
    amazing solution, it worked in SP 2003.
    thank you. also last time I used your easy tabs solution in SP 2010, so I was wondering about the “logic” behind it, means attaching java script text file as a link to content editor webpart and getting desire result.

  205. I have a question on different groups. I followed your steps and it worked great. My users who are members of the site with limited contribute only see the code and not the color event. I moved a user to the owners group and they were then able to see the calendar with colors. I changed their permission back and now they just see the code. Any ideas that I can look at to see why this is happening.
    thanks for your time

    • I found it. The library I put the HTML code in didn’t have the right permissions.

      thanks for the tutorial.

    • I am missing something on creatting the two calculated field The data type returned from this formula is: should be yes or no choice please advise

  206. We were able to follow the steps above and the calendar we created looks awesome — for most users. We have at least one user that only sees the code when they access the calendar. Everyone else sees the color-coded events, as intended. Any ideas on why someone would only see the coding??

  207. Pingback: Color Coded Calendar for SharePoint | SharePoint of no Return

  208. Hi

    I am trying to get this to work. I followed all your steps but notice the instructions were for color coding a Calendar. Will this work for a custom list on 2010?

  209. Thank you, thank you, thank you, thank you, thank you, thank you, a week of trying to come up with a soloution and oh my goodness, this is unbelievably fan-blooming-tastic!!!! thank you.

  210. Pingback: HTML Calculated Column + Client-Side Rendering | Path to SharePoint

  211. I still can’t get this to work in SP2010 – it worked great in 2007, now in 2010 it won’t work. I copied/pasted the script from here (https://blog.pathtosharepoint.com/2010/06/16/html-calculated-column-solutions-for-sp-2010-part-iv/) for SP2010 and I am not getting colors at all, just seeing the Display code instead of the actual content. Not sure why, I have created several calendars from scratch thinking it’s something in the upgrade, but still no workie.

    If anyone has any idea on how I can “test” the Content Web Editor part to see if it’s the problem I would appreciate any help. I’m not a coder, and this was easy enough to follow and implement, but I’m at a loss with troubleshooting.

  212. Hi Christophe,

    You have provided the great solution. I tried to implement the same on my test site, it worked fine but now i am unable to deploy it on the new site of mine. I have no clue what went wrong. Can you please provide me any input, the only change is that my older site was using https and now its http.

  213. Hi Christophe,

    thanks for your sharing, i think it must be very useful, but i can’t see the pictures, all the pictures displied as a red cross. : (

  214. Hi Christophe,

    thanks for your sharing, i think it must be very useful, but i can’t see the pictures, all the pictures displied as a red cross. : (

  215. Hello, Christophe – I had a very small issue with this process in my SP2007 calendars. Weirdly, the entries for All-Day Events in Month View were displaying as being a little too wide for their Day Cell. This was breaking the borders of the Day Cell and shifting subsequent, timed events to the right (I wish I could add a screengrab so you can see what I mean). However, after poking around in the source code, I figured out a fix. I added another CEWP, this time above the Calendar Web Part, and added the following style hack into the Source Editor of the new CEWP:

    .cont, .contR, .contB, .contL {
    border-bottom: 1px solid #8EBBF5;
    border-top: 1px solid #8EBBF5;
    width: 96%;

    Here, I have changed the “width:100%;” value to 96%, which shrinks the containing DIV and allows the event to display without breaking the Day Cell’s borders. I’d be interested to hear if anyone else was having this problem and whether my hack fixed it for them.

    • I see that the blog software has removed the enclosing “style” tags from my post and the trailing curly bracket, but I’m sure your readers can figure it out …

  216. Hi, Christophe — is there any way to stop numpties like the guy above (“Outlet Belstaff Madrid”) posting weird comments here? Like a Captcha code, or something …
    I want to stay connected to your site, but I get sent an email every time one of these spammy comments is added.

    • Hi Alan,

      Sorry for that. As I told another reader recently, I am trying my best to control the increasing flow of spam on WordPress. I just added some more filters. I also plan to move some of my posts to a SharePoint blog.

  217. I have two separate calendars at two separate URLs that I successfully tried this on – thanks for that! I’m having a problem where I have them both embeddeded in a view on one page – one calendar above the other. The color-coding doesn’t seem to transfer over to that view. I added Web Parts under each calendar on that view page to see if that would work, but no success. Any ideas?

    • The behavior is attached to a page, not to the list itself. So when you create a new page, you need to link to the script again. One script placed below both calendars is enough.

  218. I have set up the colour coded calendar and it works perfectly on my computer. However when other people access the calendar they see the HTML code in the calendar entries. How can I ensure others see the same view as I do?

    • It’s possible that what you have set up is a personal view of the page. To make it work for everybody, make sure you customize the shared view.
      Also, make sure that everybody has read access to the file or library where the code is stored.

  219. Hi – I am trying to apply this to Modified date. I would like to have Green for Modified Date <=5 days, Amber for <=10 and Red for anything over 11 days. Is this possible? I tried modifying the values with no luck

    • Danny, I’d suggest that you start with a simple Calculated Column with the formula =[Modified]. This will help you understand how SharePoint stores dates, and from there you’ll be able to adjust your formulas.

  220. Great tool! When I create a custom view and filter by Category (SharePoint 2007) I loose the color. Is there a workaround?

      • Same page, but that prompted me to take closer look… in my custom views I didn’t have proper calendar columns (Display, Location…) It’s working now. Thanks!

  221. i did everything as stated and still im getting as titile ” <span style=´position:Relative …" and no color change, do you have any ideas why this might happen

    • Well, probably you’re not doing *everything* as stated. In particular, make sure you pick the correct code for your SharePoint version (2007 or 2010).

      • I already checked and version is correct for 2007; already did a tryout two times with the same result:( is there something i can do to crosscheck the code

        • its below.

          is it normal that the text file uploaded, when open through sharepoint (e.g to get the the link address) appears in blank but when open through file in drive it has content?

          is there any other checks i could do?

  222. Hi – Great stuff Christophe.

    I have successfully implemented your color coded method into our Calendar List and it’s working great! However I would love to add a bit of code that lets me display the &Title& and the &End Time& when on monthly view. The Title column is already there by default which is colored, but I would like to display the End Time there as well. Thoughts?


    • If you look at the formula, you’ll see where the title is used, just add the end time next to it (you’ll also probably need a bit of formatting on the time).

Comments are closed.