Second Stanza

June 17, 2008

Windows SharePoint Services 3.0 Development Downloads

Filed under: SharePoint — Tags: — dfbaskin @ 10:40 pm

You can now use Visual Studio 2008 to develop SharePoint applications. Here are a list of downloads for Windows SharePoint Services 3.0 development:

The SharePoint Products and Technologies Service Pack 1 Resource Center has more details about WSS installations.

Introduction to SharePoint Products and Technologies for the Professional .NET Developer details capabilities of SharePoint from a developer’s perspective. The SharePoint Developer Site contains additional technical information as well.

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)

February 20, 2008

SharePoint Errors

Filed under: SharePoint — Tags: , — dfbaskin @ 3:27 pm

I had been getting the following two errors in the SharePoint server’s event logs:

Event Type:     Error 
Event Source:   Windows SharePoint Services 3 Search 
Event Category: Gatherer 
Event ID:       2424 
Description: 
The update cannot be started because the content sources cannot be 
accessed. Fix the errors and try the update again.

and

Event Type:     Error 
Event Source:   DCOM 
Event Category: None 
Event ID:       10016 
Description: 
The application-specific permission settings do not grant 
Local Activation permission for the COM Server application with CLSID 
{61738644-F196-11D0-9953-00C04FD919C1} to the user ....  
This security permission can be modified using the Component Services 
administrative tool.

The first error appears to be fixed using the technique described here:

http://guru-web.blogspot.com/2007/08/wss-30-content-indexing-update-cannot.html

The second error was fixed by using the technique described here:

http://geekswithblogs.net/mhamilton/archive/2006/12/19/101568.aspx

(the GUID in the error message corresponds to the “IIS WAMREG admin service”). A knowledgebase article, http://support.microsoft.com/kb/920783, regarding this issue says that you can safely ignore this issue, but it does give you the method to stop receiving the messages.

February 19, 2008

SharePoint Flash Audio Player Custom Web Part

Filed under: SharePoint — Tags: , — dfbaskin @ 10:31 pm

I needed to include lecture audio in a SharePoint (v3) site that I manage, using Flash as the audio player. At this point, SharePoint doesn’t include any native support for Flash files, but does allow you to create your own custom controls. Fortunately, the Developer’s Guide To Windows SharePoint Services 3.0 gives a good overview of creating a custom control (see Chapter 10, Custom Web Parts).

First, I used the MP3 to SWF Convertor (from hootech.com) to create the Flash audio player.  This utility creates two files, one containing the audio itself and another containing the player component. Both of the files should be put into a documents collection within SharePoint. (I realized later that the player component will be the same for each conversion, if the same settings are used, so you really only need one copy of the player, even though the conversion program creates a new copy for each MP3 file converted. So I end up duplicating the player for each audio file, even thought I really only needed a single player.)

Next, I installed the custom SharePoint component and created a list that contained a field built on my custom web part, which references the Flash files in my documents collection.

When editing the list item, the web part generates HTML code that allows you to enter the four pieces of information about the audio, the SharePoint URL of the Flash player component, the duration of the audio, and the width and height of the player control:

 Web part in edit mode.

When the item is viewed, then the web part generates the necessary HTML for displaying the Flash audio player:

Web part in Play mode.

The web part removes the “.player” portion of the URL to get the URL of the audio file.

This web part is a fairly crude solution since it is tied to the output of the MP3/Flash convertor and requires the user to enter the dimensions and duration of the audio, but it works nicely for my needs.

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

Blog at WordPress.com.