Dec.19

A short guide on how to create SharePoint checklists

I’ve come across the requirement to have checklists available in SharePoint quite often. But somehow I’ve always managed to get out in time before the requirement moved from the project’s short list into its product backlog. Till now. Googling for inspiration it seems that opinions differ on how to best translate the concept of a checklist into the SharePoint world. Some blog posts mention using a SharePoint Survey. I personally don’t believe in that approach. SharePoint’s Survey can hardly be customized as it’s very much a locked-down application in itself. And a SharePoint checklist app will need at least a bit of customization. You probably want to assign individual checklist items to different people. You also may want to set different due dates for individual checklist items. To me it seems that a checklist is best mapped to SharePoint in the form of a collection of tasks. Such a virtual collection can easily be created using views that group tasks for example by a Checklist ID.

A more complex challenge that needs to be tackled is the fact that a checklist is a copy of the orginal source checklist. Think, for example, of a New Hire Checklist with a couple of tasks on it: IT needs to provide a network logon and email address, facility is requested to create a new access badge … Well, I guess you get the picture. Most likely the New Hire Checklist is “owned” by the Office Manager. Each time a new employee starts working with the company, the Office Manager will print out the New Hire Checklist two weeks in advance. He or she then sends copies of it to the people involved. Maybe you’ve received one of those in the past; attached as a Word document to an email. It’s an fairly easy and quick way to ensure that people complete tasks assigned to them in a consistent manner. In fact, if you’d have to manually create and assign new tasks in SharePoint over and over again: it seems more effort instead of less. I consider finding a easy-to-use and time-saving way to overcome this challenge the key to a successful SharePoint checklist solution.

So let us think … You can create two task lists. In the first list you would then manage individual tasks, each one in fact representing a checklist item. Let’s call this list simply Checklist. It’s a custom list that will hold content of a custom type Checklist Task .

Checklist Task ContentType

This is simply a new custom SharePoint ContentType that inherits from the SharePoint Task ContentType with only one minor modification: an additional (site) column to register the Checklist ID (a number, starting at 1). The second list is identical to the first list. However, it will hold copies of the tasks that make up the checklist. Let’s call this list Assigned Tasks .

One of two task list settings

You can also think of the Checklist list as a collection of prototype tasks. It is the actual source of our checklist; the orginal document that lies somewhere on a shared network drive and that is used by the Office Manager time and again to create new copies. If you want to change the checklist e.g. by adding a new task, changing or deleting an existing task, then you would apply your changes to tasks in this very list. You could basically stop here. You can use the datasheet view to bulk copy selected checklist tasks from the source Checklist into the Assigned Tasks checklist. You maybe want to manually update the Checklist ID field so that you’re able to aggregate tasks into a checklist view.

Checklist List

But you can also try and automate this step of creating a new checklist based on the source checklist by creating a re-usable workflow using SharePoint Designer and the out-of-the-box workflow actions and conditions. This workflow should be able to be started manually. For each item in the Checklist list, it will then create a new item in the Assigned Task list. However, this is easier said then done. Why? Because SharePoint Designer Workflows don’t support for-each loops or any other form of itterative processing. In other words: You cannot itterate through all items in the source list. However, we can create two workflows that keep each other going until the last item has been processed before the last workflow will run into an error (because it cannot execute succesfully as there are no more list items left). I’m not saying that this is an ideal solution, but having tested it I can say that at the very least it works nicely and solves the SharePoint checklists challenge in a highly automated fashion using only out-of-the-box tools; no custom development is needed.

Two reusable workflows

You can see from the screenshot above that I’ve created two workflows. The first one is called Assign Checklist Task and is associated with the Checklist list. It can be started manually but will also start automatically when an item in the list is changed (see screenshot below).

Assign Checklist Task Workflow Settings

The second workflow is called Invoke Next Checklist Task Assignment and is associated with the Assigned Task list. It will start automatically each time a new item is created in the list.

Invoke Next Checklist Task Assignment Workflow Settings

The first workflow basically executes as follows:

  1. Check whether it was manually started for the first item in the Checklist list
  2. If this is the case then a variable will hold the next Checklist ID (current Checklist ID + 1)
  3. Otherwise it will assign the Checklist ID value of the current item (you’ll see in a bit that this will be updated by the second workflow)
  4. Then create a new item in the Assigned Tasks list whilst copying values from the Checklist task
  5. Creating a new item in the Assigned Tasks list will invoke the second workflow
  6. And finally set the Checklist ID value of the current item it’s processing (setting a value instead of updating a value prevents the workflow from running again)

Assign Checklist Task Workflow

The second workflow executes as follows:

  1. Calculate the previous Checklist ID (as the current Checklist ID minus one)
  2. Then update the first item found in the Checklist list that hasn’t been processed (because its Checklist ID hasn’t been set to the current Checklist ID)
  3. Updating the Checklist list in turn invokes the first workflow again
  4. When no item is being found in the Checklist list, this workflow will simply die gracefully, only reporting that an error occurred

Invoke Next Checklist Task Assignment Workflow

As a result the Assigned Tasks list will now hold new tasks that can be easily identified by the latest Checklist ID.

Assigned Tasks List

Of course this is still a very minimalistic solution and will need some documentation and instruction on some do’s and don’ts. For example, you should always select the first task in the Checklist list when you start the initial workflow to create a new checklist (instead of a random one). Also you should temporarily disable the workflow associated with the Checklist list when changing tasks. On the other hand, this way you’re really flexible in handling, manageing and tracking tasks and checklists. And it’s easy to extend this simple example with more complex checklist scenarios e.g. by creating branches since it was built using only out-of-the-box SharePoint artifacts.

Uncategorized

Dec.17

SharePoint 2010 Drag and Drop Ribbon Control

When I first saw SharePoint 2013 on a Microsoft Roadshow presentation I was really delighted seeing that in the newest version it was possible to simply (drag and) drop files in a library. I couldn’t help but think that this is one of the most desired features of all. Still, it was already possible in SharePoint 2010 where you can choose to upload multiple files. Alternatively you can simply open the library in Windows Explorer. But it all just seems miles … hm, well actually a couple of clicks away. And for every extra click with the mouse, you’ll simply loose a couple of user kudo’s.

Thinking this over again, I was wondering whether it would be possible to simply add a drop zone to the ribbon. That for sure would save a few clicks. Whilst googling for inspiration, it seemed to me that Silverlight offers out-of-the-box certain panels that allow users to drop files on. And of course the SharePoint Client Object Model supports Silverlight. Having a couple of hours of time available and virtually no Silverlight programming experience under my belt I decided to give it a go. At the very last, it would add to my programming expierence!

If you don’t bother too much about the technical details, then feel free and download your copy of the Sandbox SharePoint Package (LINK) and take it for a test drive. However, be careful. This is a Just for Fun solution. It’s not properly tested and the code hasn’t been optimized or cleaned up. In other words, it’s not supported (even though I would like to here your feedback).

1. Log on as Site Collection Administrator, navigate to Site Actions > Site Settings > Solutions and upload and activate the User Solution DragAndDropFiles.wsp

Upload and Activate WSP

2. Continue as Site Collection Administrator, navigate to Site Actions > Site Settings > Site Features and activate the new feature Drag and Drop Files for SharePoint Libraries

Activate Drag and Drop Files for SharePoint Libraries

3. You can verify whether the activation was succesful by checking the Style Library (= prerequiste) in your current web (remember, it’s a site feature) where you’ll now find three new files (DragAndDropFilesControl.xap, jquery-1.8.0.min.js, UpdateRibbonButton.js)

Style Library

4. Now navigate to a library in the site on which you just activated the site feature and activate the new Drag and Drop Ribbon Tab that is now visible (you may need to wait a few seconds before the drop zone is loaded)

Drag and Drop Ribbon Control

5. Resize the browser so you can see your desktop and drag a file onto the grey drop zone and wait until a JavaScript prompt instructs to reload the library to see the uploaded file in SharePoint (this clearly is not how the final product should work, but it’s enough to showcase my intention)

What now follows are the some more technical details. But first let me point to two site that really helped me understand the nitty gritty details of how to develop a Silverlight 4 Drag and Drop surface (LINK) and how to create your custom ribbon tab with a Silverlight control on it (LINK).

To accomplish my goal, I’ve created a solution with two separate projects. The first project is based on an empty SharePoint template whilst the second project is a Silverlight project.

VS2010 Project Structure

The DragAndDropFilesControl project will produce the Silverlight XAP file that is referenced by the SharePoint project as follows.

Including Silverlight XAP file in SharePoint project

Rather then explaining everything in the last detail, I conclude by summing up some of the difficulties I experienced. Actually, there’s only one really challenge. A Silverlight control is parameterized. You need to tell it where it can find its source and you need to tell it where it can find the SharePoint Client Object Model. However, since I decided to develop the solution as a Sandbox solution I had to first query the Client Object Model to get the site and web urls, then construct the object’s HTML and inject it into the page. The effect is, that it isn’t running as smooth as you may wish for and it feels like you’re just hacking you’re way through. However, since the ribbon is primarily manipulated on the client side anyway, I don’t see much room for improvement. Of course you could move the Silverlight drop zone out of the ribbon.

I understand that some of you may want to have a look at the code. However, since I haven’t found the time to clean up, I won’t publish it (yet). But feel free to send me your request and I may send it to you directly.

Uncategorized