SharePoint Sequential Workflow (Communications Workflow Sample)

This sample instant messaging (IM) workflow application combines Microsoft SharePoint Server with Microsoft Unified Communications Managed API (UCMA) 3.0 Workflow SDK to demonstrate the following concepts:

  • Write Web Services built on UCMA.

  • Write activities for SharePoint workflows that invoke the Microsoft .NET Web Service.

  • Handle persistence by manipulating list objects inside SharePoint workflows.

  • A SharePoint workflow activity that enables queries for user presence information from inside SharePoint workflows.

  • A SharePoint workflow activity that enables sending IM messages from inside SharePoint workflows.

  • A Web Service built on UCMA that supports sending IM, and querying for presence.

  • A runtime host for the Web Service.

  • Microsoft Lync Server 2010.

  • Microsoft Lync 2010.

  • Microsoft Visual Studio 2008 Standard, Professional, or Team System 2008, or Microsoft Visual Studio 2010 Professional, Premium, or Ultimate.

  • UCMA 3.0 Workflow SDK.

  • After installing UCMA 3.0 Workflow SDK, install a language pack.

  • Microsoft SharePoint Server.

This solution contains the following two projects:

  • UCMAWorkflowService - A console application that runs the UCMA Workflow Service.

  • UCMAWorkflowActivities - Provides the workflow activities used in SharePoint workflows.

To set up UCMAWorkflowService and build UCMAWorkflow activities

  1. Ensure SharePoint Server is installed on the computer.

  2. Load UCMASharePointWorkflow.sln in Visual Studio. Only Visual Studio editions that allow SharePoint workflow development are supported.

  3. Modify the Settings.settings file by specifying the Lync Server 2010 FQDN, UserName, Password, and User Domain that the service will run under.

  4. Build project and then press F5 to run the UCMAWorkflowService console application. Wait for console output to display the following text: "UCMA Workflow Service is ready Service Contract: http://localhost:8888/ServiceHost/UCMAWorkflowService.svc. Press <enter> to exit".

  5. Install the UCMAWorkflowActivities.dll file (this is the output of UCMAWorkflowActivities.csproj) into the GAC using the command gacutil.exe /i [Path to UCMAWorkflowActivities.dll].

  6. Locate the Web.config file for SharePoint Server. The file is most likely located at the path %SystemDrive%\inetpub\wwwroot\wss\VirtualDirectories\80\. Under the configuration node, add the contents of the output.config file to Web.config.

To create the custom SharePoint Workflow

  1. In Visual Studio, create a new SharePoint Sequential Workflow application. To find this project template, expand the Workflow node in the New Project dialog box.

  2. Right-click the Visual Studio Toolbox, and then select Choose Items.

  3. In the Choose Toolbox Items dialog box, select UCMAWorkflowActivities.dll and then click OK. This step adds the new SharePoint Server activities built by UCMAWorkflowActivities to the Toolbox.

  4. Use the GetPresence and SendIM activities to create the custom workflow.

Note Note

For both the SendIM and GetPresence activities, specify the binding for the SPWorkflowActivationProperties property as "Activity=onWorkflowActivated1, Path=WorkflowProperties".

The values of the GetPresence.Users and SendIM.User properties should follow the form "sip:<user>@domain".

The GetPresence property returns two arrays: OofNote and PresenceAvailability. The OofNote array contains Out of Office notes for each user specified in the Users property. If no OofNote is found the value at that index is null. Similarly, the PresenceAvailability array contains presence states for each user specified in the Users property.