Second Stanza

April 28, 2008

Time Slot Reservations using SharePoint

Filed under: SharePoint — Tags: — dfbaskin @ 9:21 pm

I needed to set up a finite list of time slots where my SharePoint users can reserve at most one slot. (Specifcally, it’s a list of final exam time slots, one reservation per student.) I played around with the Room and Equipment Reservations templates, but they didn’t support this concept.

So after researching different options, it seemed to me that this could be implemented using a custom list that contains the following fields:

  • Description – The description of the time slot (I just used the ‘Title’ field).
  • Date and Time – The date and time of the start of the time slot.
  • Reserved By – The user that has reserved the time slot, which only contains a value when the time slot is actually reserved.

Reservations, then, must follow these rules:

  1. Only members of a single, specific SharePoint group may actually make reservations.
  2. The users making reservations may not otherwise edit the list (but the owner of the list may).
  3. A single user may only reserve one time slot.
  4. A user may not reserve a time slot for a different user.

The list definition contains the elements I need but there is extra work required to enforce these rules.

Item #1 is covered by the “Person or Group” SharePoint data type. The “Reserved By” field is set up to only allow the selection of a user from a specific SharePoint group.

Item #2 is covered by making the list read-only for the users making the reservations.

For Item #3, code must be added so that any other reservation made by a user must be removed before adding a new reservation.

For Item #4, the reservations editor should select the current user when making a resevation.

There are a number of ways to implement all of this, but I chose to create a web part. I was interested in displaying the time slots in a calendar view, with a “Reserve” link to make it as simple as possible for a user to reserve the slot. Therefore, the web part makes use of the SPCalendarView control, populating it with SPCalendarItem objects that are based on the items from the list discussed above. The link to the calendar item is customized to allow the web part to make the reservation when the link is clicked. Then, the list item page is displayed to show the new reservation (or even if no reservation was made due to the fact the time slot is already reserved or the user is not in the correct SharePoint group).

See the links below to view or download the source code.

There are many things that could be done to this source to make it more fully functional. For example:

  1. There is not a lot of feedback given to the user if a reservation is made or not. If a reservation cannot be made, the user should at least know why.
  2. The calendar view should be handled better so that it can actually switch between month, week, and day views.
  3. It would be nice for the calendar to automatically display the month that contains the first time slot, not just the current month. The work around I use is to add “?CalendarDate={month}%2F{day}%2F{year}” to the query string when adding a link to the reservation’s web part page.
  4. A user should be able to remove a reservation. Right now, a user with edit rights to the list must perform this function.
  5. The web part needs editable properties that can be used to define the name of the list, field names, and the SharePoint group name. Currently, these names are hard-coded into the web part.
  6. A user shouldn’t be able to reserve a time slot in the past.

Download / View Source Code
(View requires Microsoft Silverlight 1.0 and Internet Explorer)


  1. Hi,
    this is really interesting and is something that i was looking for. As i do not have much programing experience, can you pl. help by explaining how to install and activate this. I would like to test this and then pass on to our development team for further modifications.

    thanks in advance

    Comment by amilahendahewa — January 13, 2009 @ 7:30 am

  2. thanks for the prompt reply.

    Comment by amilahendahewa — January 14, 2009 @ 6:50 am

  3. This code is exactly is hopefully what I’m looking for. I just got one little problem. When unpacking the code and trying to convert it in Visual Studio 2008, the conversion fails due to the lack of the file Properties/TimeSlotReservations.snk. The file is defined in the project file.

    Thanks in advance

    Comment by magstr — October 14, 2009 @ 1:41 am

  4. Hi,

    I find your solution very useful and I’m currently doing something similar. I have a question however.
    The current solution only support the month view (just like you mentioned in your todo-list). How can you implement support for day/week/month views?

    Thanks in advance!

    Comment by d00mo — November 30, 2009 @ 11:23 am

  5. Drats! So close! I was quite excited to see the parameter you add to the end of the URL to get a specific date to show in the calendar view. Unfortunately, in SP2010, it only seems to affect the header date. The calendar items shown are still from Today.

    Comment by Paul Ewert — February 8, 2012 @ 1:23 pm

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: