Blog

Development SharePoint 2010 & 2013 – Meeting Room Booking Web Part Source Code.

A common usage for SharePoint is meeting room bookings.

This article will provide one way of elegantly handling this scenario with some simple configuration. It provide a custom web parts for both SharePoint 2010 and SharePoint 2013, with full source code for both web parts along with the instruction on how to make it work.

The web part contains the following features:

  • SharePoint out of the box calendar
  • Custom List for rooms listing
  • Ability to filter by rooms title
  • Handle repeating events and Prevent double booking
  • In a later post we will add functionality to display booked rooms colored by the room color

Task1: Create Rooms List

  • Create a custom List called Rooms. This will contain the list of all available rooms. Later, we will add functionality to add a specific color for each room.

Task 2: Create Meeting Room calendar List

  • Make sure that “Team Collaboration Lists” feature is activated in Site Settings -> Site Features
  • Create new list of type Calendar and name it: “MeetingRoom

  • Go to MeetingRoom -> List Settings, click on Create Column, set the below properties
    • Column Name: Room
    • Lookup
    • Required field
    • Get Information from list Rooms
    • Show Columns: Title, ID


Task 3: Deploy and Add Web Part

  • Download SharePoint 2010 web part source code from here. Download SharePoint 2013 web part source code from here.
  • Open with Visual Studio, put your Site URL property and click on deploy. (You can instead have the WSP file from the bin folder and add the solution from PowerShell or using the STSADM command)
  • Make sure that site collection feature BookingRoom.Web is activated
  • Navigate to MeetingRoom page (/lists/meetingRoom)
  • Click on Edit Page -> Add a Web Part -> Select BookingRoom from custom web parts category and click on Add
  • Go to Web Part properties and set Calendar Webpart Title to calendar title


Task 4: Enable Session State

  • Go to Web.Config locate enableSessionState and set value equal to
    true
  • Ensure that the remove and add lines exist in the modules section for Session.

     

    • <modules
      runAllManagedModulesForAllRequests=true>


    • <remove
      name=Session />

    • <add
      name=Session
      type=System.Web.SessionState.SessionStateModule
      preCondition=“” />


    • modules>

  • Do an IISRESET

Task 5: Test Web Part

  • Add some items in the rooms list
  • Navigate to MeetingRoom page (/lists/meetingRoom)
  • Check the rooms added are listed and there is no error message
  • Try to add a new item and check if the below test cases are correct
    • Prevent booking rooms in the past
    • Prevent booking the same room in conflicting times. If we consider that Room A is already booked on 13/6/13 from 8 am to 10 am. Therefore the system must prevent booking room A on 13/6/13 on the below times:
      • From before 8 am to after 8 am
      • From below 10 am to after 10 am
    • Check repeating event and check same logic on the above case
    • Check if other than the above cases, the Item is added and shown on the calendar
  • Add many items and check if the filter button in working properly

Screen Shots

  • Default View

  • Add new booking

  • Reservation Conflict

  • Reservation occurs in the past

  • Filtered by Room A

  • Filtered by Room B and Room C

 

Download SharePoint 2010 web part source code from here.

Download SharePoint 2013 web part source code from here.

 

Sign up for our newsletter to stay up to
date with tech news!