Tuesday, July 19, 2011

Host a Windows Workflow 4.0 Designer in an Office add-in

desktopWeb.codeplex.com has a new check-in containing source code to host a Windows Workflow 4.0 designer in an Office add-in and a couple of SharePoint 2010 workflow activities. The source code is at http://desktopweb.codeplex.com/SourceControl/changeset/changes/9308 and the setup is at http://desktopweb.codeplex.com/releases/view/70858.
Update: A new check-in has a separate MyData.Workflow.Designer control.

The check-in covers the following Windows Workflow 4.0 topics:
·         Hosting a Windows Workflow 4.0 Designer surface in an Access add-in
o   Note that the WF4 designer can also be hosted in any other Office add-in such as an Excel VSTO project.
·         Custom Activity Designers  
·         Context sensitive WF4 designer expression editor that works with SharePoint 2010 Client Side Object Model (CSOM) list schema
·         Two SharePoint CSOM code activities
o   BasePermissions
o   UpdateListItem
·         Sample workflow that uses the SharePoint CSOM UpdateListItem activity to add a list item to a SharePoint task list
SharePoint CSOM code activities enable some interesting scenarios in that Office Add-in solutions that interact with SharePoint can be created in a declarative fashion. One can simply drag SharePoint 2010 activities into workflow logic and set some arguments to gain SP functionality. The check-in shows two activities as a starting point to develop other SP 2010 workflow activities. Perhaps others would like to contribute to the project by creating other SP 2010 activities. In a few weeks, I will follow up with a descriptive article about hosting a WF4 designer.
Note The designer is part of MyDataAddin. A future check-in will pull the designer out into a stand-alone UserControl.
Setup Note
In addition to running MyDataAddinSetup.msi, the custom activity designers need to be added to the GAC using the gacutil utility.
From the Visual Studio Command Prompt:

gacutil /i {FullPath}\bin\Debug\MyData.ActivityDesigners.dll

Workflow Designer
A workflow designer with custom activities can be hosted in any .NET 4.0 application (in this case an Access add-in). The vision is to create a suite of SP based activities to provide a much faster means to create Office / SharePoint applications.

SharePoint Activity Designer with Context-sensitive expression editor

1 comment: