In the last weeks I’ve extended the sample project that I’ve created for “Ribbon Customization”. You find the project source code on Codeplex:
The related articles on my blog are:
- Part 2: Sample Visual Studio 2010 project for creating a custom SharePoint 2010 Ribbon tab on runtime (!)
- Part 3: Additional Ribbon Sample: Custom Ribbon Tab generated by a delegate control that lists all associated list workflows and allow to start a workflow on a selected list item.
I’ve created a new feature for my sample project: With a delegate control a Ribbon tab will be created dynamically on list view pages if there are workflows associated with the list. For every associated workflow a button will be created. - But only for workflows that can be started manually.
To use the demo follow these steps:
1. Create a sharepoint site http://sharepoint.local/sites/ribbon.
2. Download the project from codeplex and deploy it.
3. Create one ore more workflows on the Shared Documents library at http://sharepoint.local/sites/ribbon using SharePoint Designer 2010. (I just added two list workflows on Shared Documents and added a simple “Add Comment” step to both of them.)
4. Open the document library. Upload at least one document. You get:
You see the “Workflows” tab ??
The dynamically generated workflow buttons are disabled!
NOW SELECT THE DOCUMENT!!
Now the workflow buttons are enabled!
CLICK ONE WORKFLOW BUTTON!!
You get a result window:
(It can contain an error message if one occurred.)
- An error occures if the workflow is already associated with the item. It would be possible to create a server request while “enable check” to check on the server whether the workflow is already associated to the item.
- Tests. Tests. Tests. => It’s not in a stable state!!