Here we can see, how to use a custom action within SharePoint Designer to create a custom workflow that can use the Word Automation Service to convert a document into XPS format and then declare it as an in-place record in a document library.
Here we will go through following main steps:
- Set up the environment.
- Create a workflow to convert a document using the Word Automation Service.
- Test your workflow.
Ensure that Word Automation Services starts:
- Open the SharePoint 2010 Central Administration web site by going to "Start | All Programs | Microsoft SharePoint 2010 Product | SharePoint 2010 Central Administration".
- Select Yes if a User Account Control (UAC) dialog displays asking if you would like to give this program permissions.
- When the SharePoint 2010 Central Administration page opens, under the Application Management section, click the Manage Service Applications hyperlink.
- Ensure that Word Automation Services starts.
Reduce the Time between Timer Job Runs
This task provides us with faster feedback when your timer job runs. Changing this setting on a production environment may result in performance degradation.
- Open the SharePoint 2010 Central Administration web site by going to "Start | All Programs | Microsoft SharePoint 2010 Product | SharePoint 2010 Central Administration".
- Select Yes if a User Account Control (UAC) dialog displays asking if you would like to give this program permissions.
- When the SharePoint 2010 Central Administration page opens, click the Monitoring link.
- Click the Review job definitions in Timer Jobs.
- Click the Word Automation Services Timer Job. You need to page through to get to this.
- Change the Recurring Schedule to be Every 1 minute(s).
- Click OK.
Using a Custom Workflow Action in SharePoint Designer
Now that we have configured WAS to run every minute, you can build a custom workflow to make use of this. We have supplied a sample action to use to showcase the feature.
- Browse to your application.
- Navigate to the Shared Documents document library.
- In the Library tab of the Ribbon, in the Settings group, select the Workflow Settings button.
- Click Create a Workflow in SharePoint Designer.
- You may see a warning from Internet Explorer informing you that "A Website Wants to Open Web Content Using This Program on Your Computer". If you see this message, click Allow.
- SharePoint Designer now loads.
- To add a new workflow to your list, enter a name (Convert Document t XPS) and description.
- Configure the action as follows:
URL: [%Current Item:Name%]
Output Format: XPS
Job ID: Variable: conversion job id
Overwrite status: Always overwrite
- Click the Check for Errors button in the Save group on the Ribbon. You should get a dialog box informing you that The Workflow Contains No Errors.
- Click the Publish button in the Save group on the Ribbon.
- Your workflow is now published.
Test the Workflow
- Browse to your site.
- Navigate to the Shared Documents document library.
- Select a document within the document library, and click the Edit Properties button within the Documents tab on the Ribbon.
- In the Start a New Workflow section, click the link to Convert Document to XPS.
- Click Start.