Search This Blog

Tuesday, September 25, 2012

Color coding calendar in SharePoint 2010

We put in place for our projects, SharePoint workspaces where we can share documents and collaborate with our client on the progress of their projects.
Among other items, I have created a team calendar mainly to share meetings, travels and vacations plans. Because I also wanted to manage differently those event types, I have created a Category for each of them.
·         Meeting
·         Holiday
·         Travel
·         Other
Here is my calendar with some information.
Click on the image to zoom

Because I think that color coding would help to easily identify event categories, I have created the following custom view (note that I have chosen not to display start and end time).
Click on the image to zoom

Here is the procedure to customize your calendar to be color coded.
Step 1: Create a new column [Color]. This will be used to define the color of the cell based on the category.
On the list settings page, click on Create Colum link. Name the new column “Color”, and set the type of information as Calculated (calculation based on other columns).
The formula is the following:
Finally, set The data type returned from this formula is: to Single line of text.
The result of this column will be a color name based on a category. Note that category should reflect ones you choose and color names can be changed.

Step 2: Create a new column [EventText]. This will contains the html code that will display the event text on the calendar view (including the color scheme).
As above, create a new calculated column with the following formula:

="<span 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]&";'>"&[Title]&"</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;'>"&[Title]&"</span></span>"
Note that we used the previously calculated column [Color] to define the cell color, and we also use column [Title] to display the event title inside the cell (you can also display Start Time and End Time if requested).
This is up to you to define your own style, this is simply html syntax.

Step 3: Define [EventText] column as the display on the calendar view.
You now need to create a new view for this calendar. This new view should be a Standard Calendar format view. Define properties as you wish. The important part is to display our newly created column [EventText] to replace the default Title.
 Click on the image to zoom

Let’s now save the view and check the result.
Click on the image to zoom

Not so good isn’t itL. It displays the html code instead of interpreting it. To solve this, we need to insert JavaScript code into the page.
Here is the JavaScript code (such kind of code can be found in MSDN web site or in some blogs like

// Color coded calendars for SharePoint 2010

// load our function to the delayed load list
// hook into the existing SharePoint calendar load function
function colorCalendarEventLinkIntercept()
  if (SP.UI.ApplicationPages.CalendarNotify.$4a)
    var OldCalendarNotify =
    SP.UI.ApplicationPages.CalendarNotify.$4a = function ()
  if (SP.UI.ApplicationPages.CalendarNotify.$4b)
    var OldCalendarNotify =
    SP.UI.ApplicationPages.CalendarNotify.$4b = function ()
  // future service pack change may go here!
  // if (SP.UI.ApplicationPages.CalendarNotify.???)
// hide the hyperlinks
function colorCalendarEventLinks()
// find all DIVs
  var divs = document.getElementsByTagName("DIV");
  for (var i=0;i<divs.length;i++)
    // find calendar item DIVs
    if (divs[i].className.toLowerCase()=="ms-acal-item")
divs[i].innerHTML = divs[i].innerHTML.replace(/&lt;/g,'<').replace(/&gt;/g,'>');
    // find "x more items" links and re-remove links on Expand/Contract
    if (divs[i].className.toLowerCase()=="ms-acal-ctrlitem")
      var links = divs[i].getElementsByTagName("A");
      if (links.length==1)
To include the code into the page, there are 2 solutions:On SharePoint Designer, open your SharePoint site. On the left menu, select Lists and Libraries, then click on your Calendar name on the main screen. Right Click on the view you want to color code (or create a new one first) and select Edit File in Advanced Mode.
·         Using SharePoint Designer, the JavaScript code will be added to the page code directly
·         Using Content Editor Web Part, the JavaScript code is embed in a WebPart.
Using SharePoint Designer

Identify the section below to copy your JavaScript code inside

Save and check the result.
Click on the image to zoom
You can choose to leave items like this or modify CSS styles to remove the green box around your events.
Search the section <style type="text/css"> and replace with this: 
<style type="text/css">
.ms-acal-time {
.ms-acal-selected, .ms-acal-item {
.ms-acal-sdiv span {
.ms-acal-sdiv span {
Save and check the result. Now we have the expected result J.
Using Content Editor Web Part
First of all, the script above should be saved into a txt document and uploaded in one of your site library.
Click on the image to zoom
On your custom Calendar View, select Edit page on the Site Actions menu.
Add a Content Editor Web part to Main section; this web part is located under Media and Content category. Edit the web part. Set ContentLink to your script document’s URL and Chrome type to None (this will remove web part title and borders)
Click on the image to zoom

Save and check the result.

Monday, September 24, 2012

Sharepoint 2010 MyLinks / SharePoint 2010 Error message Correlation ID

SharePoint 2010 Query Correlation ID Central Admin Page My Links Menu for SharePoint 2010

Wednesday, September 12, 2012

Understanding the Difference between Site Administrators and Site Collection Administrators and Site Collection Owners in Windows SharePoint Services

Windows SharePoint Services Site is a set of web sites on a virtual server that have the same owner and share administration settings. Each site collection contains a top-level Web site and can contain one or more subsites. There are several ‘roles’ that have different levels of control over sites at different levels. They are, in ascending level of control, the Site Administrator, the Site Collection Administrator, the Site Collection Owner, and the Server Administrator. This can become confusing especially when trying to determine who has access to the site.

Site Administrators

Have control over a site and its subsites and can:

  • delete the site
  • add or delete subsites
  • change the settings
  • view, add, delete, or change all content within the site or subsites
  • add and remove users
  • send invitations

Site Collection Administrators

Have full administrative rights to all sites and content within a site collection. In addition to having all the rights of the Site Administrator they can:

  • add and remove users from the Site Collection Users
  • modify User Information throughout the site collection. For instance, can change the e-mail or display name of a user throughout the site collection

Site Collection Owners (and Secondary Owners)

When you create a site collection, Windows SharePoint Services automatically lists you as the site collection owner. You can change the site collection owner via the Manage Site Collection Owners page in Central Administration or by using the site owner operation with Stsadm.exe. Site collection owners and secondary owners are also site collection administrators. In addition to those permissions they also:

  • receive e-mail notifications for events, such as the pending automatic deletion of inactive sites
  • receive requests for access from users who have been denied access

Server Administrators

By default any user who is a member of the Administrators group on the SharePoint server can manipulate any SharePoint site. This is not always desirable. Assuming you have install the SharePoint Portal Server 2003 Hotfix Package 898547 you can remove the Sever Administrators’ permission by running the following stsadm command:

stsadm -o setproperty -propertyname denymachineadminaccess -propertyvalue 1


Windows SharePoint Services Security Model

Users who are members of the local Administrators group have access to all the content in your Windows SharePoint Services Web sites

Members of a local administrators group can access all portals and pages of a SharePoint Portal Server 2003 site, even if they do not have permissions for the portal areas