Most activities are derived either from HandleExternalEventActivity, which is a basic Windows Workflow Foundation (WF) activity that waits for an event, or from CallExternalMethod, which is an activity that calls a class (called “local service”) that implements an interface.

The communication between the WorkflowRuntime host (which in our case is SharePoint) and the workflow follows the usual pattern that is defined by the WF team: First, SharePoint communicates with the workflow by sending events. Then, the workflow invokes SharePoint by calling a method on a dedicated interface that will redirect the call to the SharePoint API.

The interfaces that we will deal with are defined in the Microsoft.SharePoint.Workflow namespace of the Microsoft.SharePoint assembly and are decorated with ExternalDataExchangeAttribute (see the SharePoint Foundation SDK):

  •  ISharepointService
  • IListItemServices
  •  IListItemByKeyService
  •  ITaskServices
  •  IWorkflowModificationservice
  •  IWorkflowWebProvider

Developers who want to grasp the internal working of WF in SharePoint will be interested in these concepts.

Back to main article, "Creating SharePoint 2010 Workflows."