Partilhar via


Code Sample: Sandboxed Workflow Sample

Applies to: SharePoint Server 2010

The Sandboxed Workflow sample describes how to create sandboxed workflow actions that read from external lists by using the SharePoint List object model. This sample implements two sandboxed workflow actions and provides the steps to use these actions in a declarative workflow.

The following is a description of the sandboxed workflow actions that this sample creates:

  • Get External List Item by Field (Sandboxed Function)  Corresponds to the GetExternalListItemByField method in the BCSReadActivities class. This action enables you to read an item from the external list once and store it in a way that this data can be reused. More specifically, this action reads the external item from the external list and stores its fields in a data table and saves the item as XML.

  • Read External List Item Data (Sandboxed Function)  Corresponds to the GetItemDataFromString method in the BCSReadActivities class. This action returns a specified field from the external item by using the external item data that was already stored.

Prerequisites:

  • Microsoft .NET Framework 3.5 Service Pack 1

  • Microsoft SharePoint Server 2010

  • Microsoft Visual Studio 2010 installed on the same computer as SharePoint Server 2010

  • Microsoft SharePoint Designer 2010

Download and use the sample

  1. Download the Microsoft SharePoint 2010 Software Development Kit (SDK) from SharePoint 2010 Reference: Software Development Kit.

  2. Extract bcs sample kit.zip from the path %ProgramFiles%\Microsoft SDKs\SharePoint 2010\Samples\Business Connectivity Services to a local folder.

  3. In the folder where you extracted the files, locate the Sandboxed BCS Workflow Sample folder and open the Readme.htm file.

  4. Follow the instructions in Readme.htm to use the sample.